I have a batch file that calls MSBuild
and builds three Visual Studio solutions:
call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"
MSBuild solution0.sln /property:Configuration=Release
MSBuild solution1.sln /property:Configuration=Release
MSBuild solution2.sln /property:Configuration=Release
This works fine. However, I want to prompt the user to select a version of the program to build. Depending on the user input we build a particular set of solutions.
My problem is that if I modify the PATH
variable after calling vcvarsall
, I am no longer able to call MSBuild
.
call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"
set /P version="Enter the version number [1] or [2]:"
IF %version% == 1 (
set PATH="%PATH%;%PATH_TO_VERSION1_LIBS%"
MSBuild solution0_v1.sln /property:Configuration=Release
MSBuild solution1_v1.sln /property:Configuration=Release
MSBuild solution2_v1.sln /property:Configuration=Release
)
IF %version% == 2 (
set PATH="%PATH%;%PATH_TO_VERSION2_LIBS%"
MSBuild solution0_v2.sln /property:Configuration=Release
MSBuild solution1_v2.sln /property:Configuration=Release
MSBuild solution2_v2.sln /property:Configuration=Release
)
I get the following error:
Setting environment for using Microsoft Visual Studio 2010 x86 tools.
ERROR: Cannot determine the location of the VS Common Tools folder.
This is puzzling because the environment variable VS100COMNTOOLS
is defined.