如何在不安装IDE的情况下在构建服务器上安装VS2017版本的msbuild?

问题描述 投票:183回答:2

从历史上看,这已经与Microsoft Build Tools完成了。但似乎the Build Tools may not be available for versions after 2015。替换似乎是Visual Studio构建工具,它似乎还没有真正的主页。

我下载了VS2017 Professional installer,然后转到Individual Components选项卡。然后,摘要告诉我Visual Studio核心编辑器在那里,占用753MB。我不想要编辑。只是msbuild。没有办法取消选择编辑器。

有没有办法安装最新版本的msbuild而不安装Visual Studio IDE?

msbuild visual-studio-2017 build-tools build-server
2个回答
291
投票

Visual Studio Build工具与IDE的下载不同。它们似乎是一个非常小的子集,它们被称为Visual Studio 2019的构建工具(download)。

您可以使用GUI进行安装,也可以编写msbuild的安装脚本:

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

Microsoft.VisualStudio.Workload.MSBuildTools是the three subcomponents you need的“包装器”ID:

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

您可以找到有关其他可用CLI开关here的文档。

构建工具安装比完整IDE快得多。在我的测试中,花了5-10秒。使用--quiet除了短暂的光标更改之外没有进度指示器。如果安装成功,您应该能够在%programfiles(x86)%\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin中看到构建工具。

如果您在那里没有看到它们,请尝试在没有--quiet的情况下运行,以查看安装期间可能出现的任何错误消息。

© www.soinside.com 2019 - 2024. All rights reserved.