MSBuild 不获取被引用项目的引用 [英] MSBuild doesn't pick up references of the referenced project

查看:29
本文介绍了MSBuild 不获取被引用项目的引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚才在使用 MSBuild 时遇到了一个奇怪的情况.有一个解决方案包含三个项目:LibX、LibY 和 Exe.Exe 引用了 LibX.LibX 又引用了 LibY,有一些内容文件,还引用了第三方库(安装在 GAC 和本地 lib 文件夹中的几个预构建程序集).第三方库被标记为复制本地"(私有")并出现在 LibX 项目的输出中,就像 LibY 的输出和 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 不获取被引用项目的引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆