问题描述
我有三个Visual Studio解决方案。一个解决方案/项目(Project1)定义了一个接口(例如IChokable)。第二个解决方案/项目(Project2)包含一个类,它创建一个实现IChokable的对象(fooChicken)。所以Project2必须引用Project1,我明白了。
在第三个解决方案/项目(Project3)中,我创建了一个fooChicken对象。所以Project3必须包含对Project2的引用,我明白了。
但是 - 这不会编译。它抱怨Project3必须还包含对Project1的引用,即使Project3从未尝试访问fooChicken对象上的任何IChokable元素。
我只是在做这个错了?我是否真的必须在每个项目中都引用每个项目引用的每个项目?这让我觉得不对劲。并不是真的可行。如果Project3中的应用程序已经存在于世界中,并且我更新了Project2中的对象以包含新引用并将它们发送出去,该怎么办?那些Project3对象是否会停止运行?
我肯定在这里遗漏了一些东西。这只是Visual Studio的调试首选项吗?
I have three Visual Studio solutions. One solution/project (Project1) defines an interface (IChokable, say). The second solution/project (Project2) contains a a class which creates an object (fooChicken) which implements IChokable. So Project2 has to have a reference to Project1, I get that.
In a third solution/project (Project3), I create a fooChicken object. So Project3 must contain a reference to Project2, I get that.
HOWEVER - this won't compile. It complains that Project3 must ALSO contain a reference to Project1, even though Project3 never tries to access any of the elements of IChokable on the fooChicken object.
Am I just doing this wrong? Do I really have to have a reference in every project to every project referenced by every other project? This strikes me as wrong. And not really doable. What if the app from Project3 existed in the world already, and I updated the objects from Project2 to contain new references, and shipped them? Would those Project3 objects stop functioning?
Surely I am missing something here. Is this just a debugging preference by Visual Studio?
这篇关于第三方参考?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!