简体   繁体   English

.NET和Visual Studio中相同解决方案中的引用

[英]References in same solution in .NET and Visual Studio

I need you guys to finally arrange this issue well in my head. 我需要你们终于把这个问题安排在我脑海中。

As an example, my solution contains two projects: 例如,我的解决方案包含两个项目:

Project 1 has a reference to the Moq class library. 项目1引用了Moq类库。

Project 2 (which is a unit test project) has a reference to Project 1. 项目2(这是一个单元测试项目)具有对项目1的引用。

Both needs to utilize Moq classes directly. 两者都需要直接利用Moq类。

Does Project 2 need to have a reference to the Moq class library as well? Project 2是否也需要引用Moq类库?

What if Project 1 has a static method MethodX which utilize a Moq method and returns a non Moq class library based type, and Project 2 needs to run MethodX? 如果Project 1具有使用Moq方法的静态方法MethodX并返回基于非Moq类库的类型,并且Project 2需要运行MethodX怎么办? Should Project 2 still need a reference to the Moq class library? Project 2是否仍需要引用Moq类库?

Thanks, 谢谢,

Mikey 米奇

Project 2 needs reference to the Moq library only if this projects have direct access to objects declared in library through Project 1. 仅当项目2通过项目1直接访问库中声明的对象时,项目2才需要引用Moq库。

Otherwise, if Project 1 isolates Moq's classes, types, structs and uses them for internal purposes only - the reference is not needed. 否则,如果Project 1隔离Moq的类,类型,结构并将其仅用于内部目的-则不需要引用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Visual Studio解决方案参考 - Visual Studio Solution References .NET 4.5中的Visual Studio解决方案中的项目引用 - Project References within a Visual Studio Solution in .NET 4.5 Visual Studio 2017 解决方案中丢失的引用 - Lost references in Visual Studio 2017 solution 有没有办法告诉 Visual Studio 在 .Net Core 解决方案中只使用特定类型的引用? - Is there a way to tell Visual Studio to use only specific kinds of references in a .Net Core solution? 在 Visual Studio 2019“解决方案资源管理器”中看不到“参考”文件夹 - cannot see “References” folder in Visual Studio 2019 “Solution Explorer” 如何使用 CMake 为 Visual Studio 解决方案设置程序集引用? - How to set assembly references for Visual Studio solution using CMake? Visual Studio在解决方案资源管理器中不显示来自目标的引用 - Visual Studio does not display references from targets in Solution Explorer 使用Roslyn查找Visual Studio解决方案中的所有引用 - Find all references in Visual Studio solution using Roslyn 如何处理 C# Visual Studio 解决方案中的引用? - How to handle references in a C# Visual Studio solution? 在Visual Studio中的相同解决方案中引用项目 - Referencing a Project in the Same Solution in Visual Studio
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM