Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
392 views
in Technique[技术] by (71.8m points)

Prebuild event in Visual Studio replacing $(SolutionDir) with *Undefined*

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:WINDOWSMicrosoft.NETFrameworkv3.5MSBuild.exe" /p:configuration=Release;platform=x86 /t:rebuild "$(SolutionDir)Folder1Project1.csproj"

"C:WINDOWSMicrosoft.NETFrameworkv3.5MSBuild.exe" /p:configuration=Release;platform=x86 /t:rebuild "$(SolutionDir)Folder2Folder3Project2.csproj" 

The first one succeeds and the other fails saying that The command ""C:WINDOWSMicrosoft.NETFrameworkv3.5MSBuild.exe" /p:configuration=Release;platform=x86 /t:rebuild "*Undefined*Folder2Folder3Project2.csproj"" exited with code 1..

Edit:
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.

question from:https://stackoverflow.com/questions/635346/prebuild-event-in-visual-studio-replacing-solutiondir-with-undefined

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...