Visual Studio 2017 with VS 2015 command prompt + vcvarsall has no effect + nmake not found

4.4k views Asked by At

I've got Visual Studio 2017 installed together with 14.0 platfrom tools.

The problem is: nmake is not recognised as a command. I have tried setting up the environment, by running vcvarsall in the VS2015 x64 command prompt, for example, by using the following command:

 vcvarsall x86_amd64

The command above had no effect and showed the following error:

Error in script usage. The correct usage is: vcvarsall [option] or vcvarsall [option] store or vcvarsall [option] [version number] or vcvarsall [option] store [version number] where [option] is: x86 | amd64 | arm | x86_amd64 | x86_arm | amd64_x86 | amd64_arm where [version number] is either the full Windows 10 SDK version number or "8.1" to use the windows 8.1 SDK

4

There are 4 answers

0
Serge Rogatch On

Try implementing another batch file with approximately the following commads (depending on your path). After running this batch file, you should get a command prompt with the variables set and nmake on the path.

call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64
call cmd

At least, this works for me (except that in the second command I launch FAR Manager instead of plain cmd).

0
Vega4 On

The solution, which I've found for myself, was to use vcvars64.batlocated in

C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\

You need to run this batch file from the VS 2015 x64 command prompt.

 C:\Program Files (x86)\Microsoft Visual Studio 14.0

is the path of platform tools version 14.0

There is a seperate folder for each supported platform, in this example - it is amd64.

The Visual Studio 2015 command prompt comes installed together with platform tools version 14.0.

After you run the command the environment is set-up.

5
Niall On

This is a known issue with the command prompt shortcuts installed for the VS2015 tool sets with the VS2017 installation.

VS2017 Update 3 (v15.3) added a new argument to the installed command prompts (see here);

The Developer Command Prompt for Visual Studio (and the Visual C++ Command Prompt) have added support for initializing a command-prompt environment targeting the Visual C++ 2015 Toolset (v140) via the -vcvars_ver=14.0 argument

Basically, copy the short cut to the VS2017 command prompts and add the argument to the copied shortcut.

vcvarsall x86_amd64 -vcvars_ver=14.0

You could dive deeper into the command files for the more specific version you are looking for, but given the machinery of the command prompts, it is probably better to add it to the top level prompts.

0
Nkosi Dean On

The solution for me is a modified version of @Niall's solution. I leave out the "vscarsall" and "x86_amd64" part. In other words, running the following as either a Shortcut target or in the Windows Run window works for me:

%comspec% /k "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat" -vcvars_ver=14.0

This is just the start menu shortcut target with the "-vcvars_ver=14.0" added at the end. I copied the Start Menu shortcuts and added the "-vcvars_ver=14.0" to the new shortcuts and it appears to work.

That's all for the "Developer Command Prompt for VS 2017". This appears to work the same way for the "x64 Native Tools Command Prompt for VS 2017" and "x86 Native Tools Command Prompt for VS 2017" shortcuts as well.

%comspec% /k "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" -vcvars_ver=14.0

%comspec% /k "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars32.bat" -vcvars_ver=14.0