Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS2017 command line build (missing "%VS150COMNTOOLS%VSVars32.bat")

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?

like image 708
Adam Benson Avatar asked Mar 24 '17 10:03

Adam Benson


2 Answers

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 where EDITION 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.

like image 181
Adam Benson Avatar answered Sep 21 '22 16:09

Adam Benson


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"
like image 41
Sentient Entities Avatar answered Sep 19 '22 16:09

Sentient Entities