VS2015/MsBuild/vsvars32.bat:无法确定VS安装的位置 [英] VS2015 / MsBuild / vsvars32.bat : Cannot determine the location of the VS installation
问题描述
我使用批处理来构建我的解决方案.它可以在Visual Studio 2013中正常工作. 但是在Visual Studio 2015中会发生此错误:
I use a batch to build my solution. It work fine with Visual Studio 2013. But with Visual Studio 2015 this error occurs :
错误:无法确定VS安装的位置
ERROR: Cannot determine the location of the VS installation
VS2013的批次
调用%VS120COMNTOOLS%vsvars32.bat"
msbuild solution.sln/t:重建/p:配置=发布/p:平台=任何CPU"
call "%VS120COMNTOOLS%vsvars32.bat"
msbuild solution.sln /t:rebuild /p:Configuration=Release /p:Platform="Any CPU"
工作正常.
VS2015的批次
调用%VS140COMNTOOLS%vsvars32.bat"
msbuild solution.sln/t:重建/p:配置=发布/p:平台=任何CPU"
call "%VS140COMNTOOLS%vsvars32.bat"
msbuild solution.sln /t:rebuild /p:Configuration=Release /p:Platform="Any CPU"
错误:无法确定VS安装的位置.
ERROR: Cannot determine the location of the VS installation.
环境变量 VS140COMNTOOLS 定义为
C:\ Program Files \ Microsoft Visual Studio 14.0 \ Common7 \ Tools
这不是我的操作系统(Windows 8.1 64位)上的理想路径. 因此,我将 VS140COMNTOOLS 设置为
It's not the good path on my OS (Windows 8.1 64 bits). So I set VS140COMNTOOLS to
C:\ Program Files(x86)\ Microsoft Visual Studio 14.0 \ Common7 \ Tools
但是错误消息仍然相同.
But error message still the same.
如果有人有想法...
在此先感谢:)
If anyone has ideas...
Thanks in advance :)
我已经找到了mklink的临时解决方法(并增加了对旧版Visual Studio的兼容性):
I have found this temporary workaround with mklink (and add 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...
)
)
...,然后调用msbuild.
... and after call msbuild.
您有最佳解决方案吗?...
Have you a best solution ?...
推荐答案
对我来说,HKLM \ SOFTWARE \ Microsoft \ VisualStudio \ SxS \ VS7中的路径缺少(x86)
.
For me, the path in HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VS7 was missing (x86)
.
可以使用以下.reg
文件解决该问题:
It can be solved with 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\\"
谢谢您的提示.
这篇关于VS2015/MsBuild/vsvars32.bat:无法确定VS安装的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!