Cannot determine the location of the VS Common Tools folder

给你一囗甜甜゛ 提交于 2020-01-05 10:09:45

问题


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.


回答1:


this might be a parsing error, try:

IF "%version%"=="1" set "PATH=%PATH%;%PATH_TO_VERSION1_LIBS%"
IF "%version%"=="1" (
    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%"
IF "%version%"=="2" (
    MSBuild solution0_v2.sln  /property:Configuration=Release
    MSBuild solution1_v2.sln  /property:Configuration=Release   
    MSBuild solution2_v2.sln  /property:Configuration=Release
)


来源:https://stackoverflow.com/questions/17491797/cannot-determine-the-location-of-the-vs-common-tools-folder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!