Reputation: 8522
I have installed VS2017 and call
call "%VS120COMNTOOLS%VSVars32.bat"
from the command line but all I get is
'"%VS150COMNTOOLS%VSVars32.bat"' is not recognized as an internal or external command, operable program or batch file.
If I run "set" from the command line I can see VS120COMNTOOLS (for VS2013) & VS140COMNTOOLS (for VS2015) but there is no VS150COMNTOOLS. How can I build from the command line?
Upvotes: 11
Views: 17880
Reputation: 418
If its any help to anyone... If you modify your Visual Studio 2017 installation to install the component: "VC++ 2015.3 v140 toolset for Desktop (x86,x64)"
then the 'VSVars32.bat' file which is missing, will be installed (as its a component of VC++ 2015, but not VC++ 2017).
Upvotes: 1
Reputation: 8522
I submitted this as a tech support issue to Microsoft who accepted it as a bug in the install ("there is no VSVars32.bat in the C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools
directory.").
However, there is a work-around:
From MS:
At least, since there is a VsDevCmd.bat, there is a Visual Studio 2017 Developer Command Prompt, which also sets, modifies environment variables (Framework40Verion, FrameworkDir, FrameworkDIR64, FrameworkVersion, FrameworkVersion64, INCLUDE, IPCPATH, PATH, VCINSTALLDIR, VCToolsInstallDir, ...)
C:\Program Files (x86)\Microsoft Visual Studio\2017\EDITION\Common7\Tools\VsDevCmd.bat
Run
C:\Program Files (x86)\Microsoft Visual Studio\2017\EDITION\Common7\Tools\VsDevCmd.bat
whereEDITION
is the type of VS2017 install, i.e.C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\VsDevCmd.bat
for the Enterprise install. This sets up the needed environment variables and batch builds will work.
Hope this helps anyone struggling with the same issue.
Upvotes: 8
Reputation: 341
VS2017 has reworked its directory structure and filenames. The file is no longer titled "VsVars32.bat", you should look for the file 'vcvars.bat', which can be located in ..\Program Files (x86)\Microsoft Visual Studio\2017\EDITION\Common7\Tools\vsdevcmd\ext\vcvars.bat
(using Adam's syntax, replace EDITION
with the version of Visual Studio you use).
For simplicity, you can use %VSAPPIDDIR%
in your call to point to the IDE folder where devenv.exe is located, and go back one folder to define your path to the batch file. For example:
call "%VSAPPIDDIR%..\Tools\vsdevcmd\ext\vcvars.bat"
Upvotes: 2