找不到MSBuild.exe,cmd.exe [英] MSBuild.exe not found, cmd.exe

查看:1148
本文介绍了找不到MSBuild.exe,cmd.exe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近安装了Visual Studio 2017,MSBuild.exe不应该随它一起提供吗? bash脚本之一正在调用它,但是找不到任何东西.

I recently installed Visual Studio 2017, shouldn't MSBuild.exe come with it? One of bash scripts is calling it, but can't find anything.

这是build.bat产生错误的部分(您可以看到整个文件此处)

Here is the part of build.bat that yields error (you can see the whole file here)

MSBuild.exe mpc-hc.sln %MSBUILD_SWITCHES%^
 /target:%BUILDTYPE% /property:Configuration="%BUILDCFG% Filter";Platform=%1^
 /flp1:LogFile=%LOG_DIR%\filters_errors_%BUILDCFG%_%1.log;errorsonly;Verbosity=diagnostic^
 /flp2:LogFile=%LOG_DIR%\filters_warnings_%BUILDCFG%_%1.log;warningsonly;Verbosity=diagnostic
IF %ERRORLEVEL% NEQ 0 (
  CALL "%COMMON%" :SubMsg "ERROR" "mpc-hc.sln %BUILDCFG% Filter %1 - Compilation failed!"
  EXIT /B
) ELSE (
  CALL "%COMMON%" :SubMsg "INFO" "mpc-hc.sln %BUILDCFG% Filter %1 compiled successfully"
)

推荐答案

您可以使用Visual Studio 2017随附的vswhere 1 . 它位于"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe".

You can use vswhere 1 which comes with Visual Studio 2017. It is located in "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe".

MSBuild.exe的路径部分然后被vswhere -nologo -latest -property installationPath检索,其结果例如是C:\Program Files (x86)\Microsoft Visual Studio\2017\Community. 现在,根据您要使用的msbuild版本,您可以猜测路径的其余部分:

The part of the path to MSBuild.exe is then retrived by vswhere -nologo -latest -property installationPath, which results e.g., in C:\Program Files (x86)\Microsoft Visual Studio\2017\Community. Based on the msbuild Version you want to use you can now guess the rest of the path:

C:\ Program Files(x86)\ Microsoft Visual Studio \ 2017 \ Community \ MSBuild \ 版本 \ Bin \ MSBuild.exe

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\VERSION\Bin\MSBuild.exe

其中 VERSION (例如,版本installationVersion: 15.3.26730.1215.0)由"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -property installationVersion支持.

where VERSION is e.g., 15.0 for Version installationVersion: 15.3.26730.12as ouputed by "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -property installationVersion.

1 参见 GitHub

这篇关于找不到MSBuild.exe,cmd.exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆