VS2015 / MsBuild / vsvars32.bat: unable to determine VS installation location

I use the package to create my solution. It works fine with Visual Studio 2013. But with Visual Studio 2015, this error occurs:

ERROR: Unable to locate VS installation

Package for VS2013

call "% VS120COMNTOOLS% vsvars32.bat"
msbuild solution.sln / t: rebuild / p: Configuration = Release / p: Platform = "Any processor"

Work great.

Package for VS2015

call "% VS140COMNTOOLS% vsvars32.bat"
msbuild solution.sln / t: rebuild / p: Configuration = Release / p: Platform = "Any processor"

ERROR: Unable to locate VS installation.


The VS140COMNTOOLS environment variable is defined as

C: \ Program Files \ Microsoft Visual Studio 14.0 \ Common7 \ Tools

This is not a good way to my OS (Windows 8.1 64 bit). So I set VS140COMNTOOLS to

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

But the error message remains the same.

If anyone has any ideas ...
Thanks in advance:)

EDIT

I found this temporary workaround with mklink (and adds compatibility for older Visual Studio):

IF NOT "%VS140COMNTOOLS%" == "" ( IF NOT EXIST "%VS140COMNTOOLS%" ( mklink /J "%VS140COMNTOOLS%" "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools" ) call "%VS140COMNTOOLS%vsvars32.bat" echo Visual Studio 2015... ) ELSE ( IF NOT "%VS120COMNTOOLS%" == "" ( call "%VS120COMNTOOLS%vsvars32.bat" echo Visual Studio 2013... ) ELSE ( call "%VS110COMNTOOLS%vsvars32.bat" echo Visual Studio 2012... ) ) 

... and after calling msbuild.

Do you have a better solution? ...

+6
source share
4 answers

For me, the path to HKLM \ SOFTWARE \ Microsoft \ VisualStudio \ SxS \ VS7 was missing (x86) .

It can be solved using this .reg file:

 Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\SxS\VS7] "14.0"="C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\" 

Thanks for the tip.

+8
source

I had the same issue recently. The problem was an excessively long PATH, as a result of which the command C:\Windows\System32\reg.exe not found when called in a batch file. I removed everything I could from my PATH and this fixed the problem.

+4
source

I had a similar problem with VS 2013 and% VS110COMNTOOLS% ... I tried a lot of things that I found over the Internet but no one worked, also the most common solution I found on the Internet was that C: \ windows \ system32 was not in the PATH environment variable, but on my machine all the variables were correct and pointed to the correct directories.

I had an image with window 10 with vs2017 installed and other visual studios have not yet been installed, so I restored this image, then went on to install VS2013, then installed VS2010, and then finally installed VS2012.

After that, the assembly went fine and the error disappeared ... I assume that installing VS2012 as the last resolved the problem associated with the VS110COMNTOOLS variable, even if I tried to reinstall all the visual studios before returning to the windows of the 10 images that I have were.

I hope you can do something like this on your computer, try to restore your system to the point before installing the visual studio, and then install the visual studios you need, leaving VS2015 as the last.

+2
source

In my case, the problem was that registry editing was disabled on my PC completely by my system administrator.

This led to the reg command line command not working, and this leads to an error message.

The solution was to enable registry access.

Note. This also led to disabling the regedit function, so the manual fix specified in another answer was not working for me.

0
source

All Articles