升级到 VS2010 时 MSBuild 无法构建引用的项目
我最近将包含一些 C# 代码项目和 ASP.net 网站项目的 .Net 3.5 解决方案升级到 VS2010(从 VS2008)。它在 VS 内构建并运行良好,但当我尝试通过 TeamCity 使用 MSBuild 4.0 在我的服务器上构建它时遇到一些问题。似乎从网站引用的项目尚未构建。在我升级到 VS2010、MSbuild 4.0 和 Windows SDK 7.1 之前,这一切都工作正常。
在我用来从 teamcity 构建的 msbuild 脚本中,我为网站定义了项目引用,如下所示:
<ProjectReference Include="..\src\trunk\DataAccess\DataAccess.csproj">
<Project>{C43242F4-7286-4BEC-9A27-001D6FC14860}</Project>
<Name>DataAccess</Name>
</ProjectReference>
当我尝试运行构建脚本时,我收到一条错误消息,指出在尝试复制它时找不到 dll 文件从引用项目的 bin 文件夹复制到网站的 bin 文件夹中。发生这种情况是因为引用的项目实际上从未构建过(项目目录中不存在 bin 文件夹)。
有谁知道可能导致此问题的原因吗?我对 MSbuild 不太有经验,所以我可能忽略了一些重要的东西。如果不存在项目输出,MSbuild 是否会自动尝试构建引用的项目?
将不胜感激任何帮助!
I have recently upgraded my .Net 3.5 solution containing some C# code projects and a ASP.net web site project to VS2010 (from VS2008). It is building and running fine inside VS, but I get some problems when trying to build it on my server with MSBuild 4.0 via TeamCity. It seems like the projects that are referenced from the web site are not built. This was all working fine before I upgraded to VS2010, MSbuild 4.0 and Windows SDK 7.1.
Inside the msbuild script that I use to build from teamcity I have defined project references for the web site like this:
<ProjectReference Include="..\src\trunk\DataAccess\DataAccess.csproj">
<Project>{C43242F4-7286-4BEC-9A27-001D6FC14860}</Project>
<Name>DataAccess</Name>
</ProjectReference>
When I try to run the build script I get an error message saying that it could not find the dll file when trying to copy it from the bin folder of the referenced project into the bin folder of the web site. This is happening because the referenced projects are in fact never built at all (No bin folder exists in the project dir).
Does anyone have a clue what may cause this? I am not very experienced with MSbuild, so I may have overlooked some important stuff. Is it not so that MSbuild will automatically try to build the referenced projects if no project output is existing?
Will be thankful for any help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我需要更多信息来指导您,但我突然尝试添加
到您的 msbuild 调用中。
I would need some more info to guide you on this, but off the top of my head try adding
to your msbuild call.
我在该网站上找到了另一篇帖子,描述了您完全相同的问题。我也遇到了同样的问题。
这个
I found another post on this website describing your exact same problem. I also ran into this same problem too.
This blog on the MSDN Website describes the problem and the work-around. Basically it's a limitation of solution files which are not in an MSBuild format, but just a fancy text file. And the real thing is, that the dependencies need to be specified in the project files them selves not the solution file. ahhh... just read the link it explains it a hundred times better than my answer here.