Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
390 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 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...