我有一个调用MSBuild
和构建三个 Visual Studio 解决方案的批处理文件:
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
这工作正常。但是,我想提示用户选择要构建的程序版本。根据用户输入,我们构建了一组特定的解决方案。
我的问题是,如果我PATH
在调用后修改变量vcvarsall
,我将无法再调用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
)
我收到以下错误:
Setting environment for using Microsoft Visual Studio 2010 x86 tools.
ERROR: Cannot determine the location of the VS Common Tools folder.
这很令人费解,因为定义了环境变量VS100COMNTOOLS
。