[英]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.