问题描述
我刚刚遇到了MSBuild的一个奇怪情况.有一个包含三个项目的解决方案:LibX,LibY和Exe. Exe引用LibX. LibX依次引用LibY,具有一些内容文件,并且还引用了第三方库(在GAC和本地lib文件夹中都安装了几个预先构建的程序集).第三方库被标记为复制本地"(私有"),并与LibY的输出和LibX的内容文件一样显示在LibX项目的输出中.现在,Exe项目的输出包含LibX项目输出,LibX项目的内容文件,LibY项目输出(来自LibX),但没有第三方库的程序集.
I bumped into a strange situation with MSBuild just now. There's a solution which has three projects: LibX, LibY and Exe. Exe references LibX. LibX in its turn references LibY, has some content files, and also references to a third-party library (several pre-built assemblies installed in both GAC and local lib folder). The third-party library is marked as "Copy Local" ("private") and appears in the output of the LibX project, as the LibY's output and LibX's content files do. Now, Exe project's output has LibX project output, content files of the LibX project, LibY project output (coming from LibX), but NO third-party library's assemblies.
现在,我通过直接在Exe项目中引用第三方库来解决此问题,但我不认为这是一个正确"的解决方案.
Now I worked this around by referencing the third-party library directly in Exe project, but I don't feel this is a "right" solution.
以前有人遇到过这个问题吗?
Anyone had this problem before?
推荐答案
是的,我也遇到了这个问题.尽管我很想说别的,但我相信您必须在构建文件中包括所有传递依赖项作为引用.
Yes, I've had that problem, too. Though I'd love to say otherwise, I believe you must include all transitive dependencies as references in your build file.
这篇关于MSBuild不会获取所引用项目的引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!