[转]How can I install the VS2017 version of msbuild on a build server without installing the IDE?

时间:2021-09-03 07:23:59

本文转自;http://*.com/questions/42696948/how-can-i-install-the-vs2017-version-of-msbuild-on-a-build-server-without-instal

 

 

The Visual Studio Build tools are a different download than the IDE. They appear to be a pretty small subset.

  1. On the Visual Studio download page, expand Other Tools and Frameworks at the bottom of the page
  2. Download the Visual Studio build tools

You can then use the GUI to do the installation, or you can script the installation of msbuild:

vs_buildtools.exe --add Microsoft.VisualStudio.Workload.MSBuildTools --quiet

Microsoft.VisualStudio.Workload.MSBuildTools is a "wrapper" ID for the three subcomponents you need:

  • Microsoft.Component.MSBuild
  • Microsoft.VisualStudio.Component.CoreBuildTools
  • Microsoft.VisualStudio.Component.Roslyn.Compiler

You can find documentation about the other available CLI switches here.

The build tools installation is much quicker than the full IDE. In my test, it took 5-10 seconds. With --quiet there is no progress indicator other than a brief cursor change. If the installation was successful, you should be able to see the build tools in %programfiles(x86)%\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin.

If you don't see them there, try running without --quiet to see any error messages that may occur during installation.