Visual Studio 中的预构建事件将 $(SolutionDir) 替换为 *Undefined* [英] Prebuild event in Visual Studio replacing $(SolutionDir) with *Undefined*

查看:15
本文介绍了Visual Studio 中的预构建事件将 $(SolutionDir) 替换为 *Undefined*的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我相信问题已在此处 移动在这里看起来它可能是visual studio中的一个错误,但我想知道是否有人知道解决方法.

I believe the problem is documented here moved here and looks like it might be a bug in visual studio, but I'm wondering if anyone knows of a workaround.

基本上我有以下两行(除其他外)在预构建事件中一个接一个.

Basically I have the following two lines (among other things) one right after the other in the prebuild event.

"C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe" /p:configuration=Release;platform=x86 /t:rebuild "$(SolutionDir)Folder1\Project1.csproj"

"C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe" /p:configuration=Release;platform=x86 /t:rebuild "$(SolutionDir)Folder2\Folder3\Project2.csproj" 

第一个成功,另一个失败说命令""C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe"/p:configuration=Release;platform=x86/t:rebuild "*Undefined*Folder2\Folder3\Project2.csproj"" 以代码 1 退出..

The first one succeeds and the other fails saying that The command ""C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe" /p:configuration=Release;platform=x86 /t:rebuild "*Undefined*Folder2\Folder3\Project2.csproj"" exited with code 1..


发现问题是与预构建相同的其他项目之一失败了,因为 MSBuild 本身不知道宏.


Figured out the problem was that one of the other projects with the same line as it's prebuild failed, since MSBuild itself doesn't know about the macros.

推荐答案

我通过将所有 $(SolutionDir) 替换为 $(ProjectDir)..\ 解决了这个问题.

I fixed this by replacing all $(SolutionDir) with $(ProjectDir)..\.

这是由于 MSBuild 独立运行每个项目,因此不是解决方案.它在 VS2010 中运行良好,但在构建服务器上运行不正常.

It was due to MSBuild running each project independently, and thus not the solution. It worked fine in VS2010, but not on the build server.

这篇关于Visual Studio 中的预构建事件将 $(SolutionDir) 替换为 *Undefined*的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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