I installed Visual Studio 2017 and toolsets v140
and v141
. To work with v140
toolset, I need to set the necessary environment via vc
I've managed to solve, so to speek, this issue using the following approach. For toolset v140
vcvars
tries to obtain the required data from the registry (Visual Studio 14.0 installation directory), but, because it fails to do so, exits with an error. If you add to the Windows registry the required value, vcvars
will work correctly. In case of toolset v140
installed along with Visual Studio 2017 this path for the default installation is C:\Program Files (x86)\Microsoft Visual Studio\Shared\14.0\
.
You need to locate the existing key where the Visual Studio 2017 installation directory is set (in my case it is HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\SxS\VS7
) and add the key with name 14.0 and value C:\Program Files (x86)\Microsoft Visual Studio\Shared\14.0\
As stated in the Microsoft forums here modifying the vcvarsall.bat script seems to solve the issue with latest VS tool installed (it did for my installation)
In case the link goes dead: the solution is to comment line 8 (or 10 depending if there are two blank lines at the beginning of the file)
The problem line is
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community>CALL "VC\Auxiliary\Build\vcvars64.bat" -vcvars_ver=14.16 10.0.18362.0
I just went to C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build
and found vcvars64.bat
.
After studying it, I modified it like this
REM @call "%~dp0vcvarsall.bat" x64 %*
@call "%~dp0vcvarsall.bat" x64
getting rid of the offending 14.16 10.0.18362.0
parameter. It worked. No messing up with the register.
There is an additional command-line argument for the newer vcvars*.bat
files: vcvars_ver
.
To setup an enviroment using the VS2015 toolchain with VS2017 one has to append -vcvars_ver=14.0
to the new vcvars*.bat
call.
E.g. "c:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvarsall.bat" x64 8.1 -vcvars_ver=14.0
sets up an environment for x64 using Windows 8.1 SDK and the MSVC2015 toolchain.
There is no need to change any value in the registry or modify the installed batch files.
Source: https://developercommunity.visualstudio.com/solutions/140023/view.html