219

Historically, this has been done with the Microsoft Build Tools. But it seems that the Build Tools may not be available for versions after 2015. The replacement appears to be the Visual Studio build tools, which doesn't seem to have a real homepage yet.

I downloaded the VS2017 Professional installer, and went to the Individual Components tab. Right away, the summary is telling me that the Visual Studio core editor is there, taking up 753MB. I don't want the editor. Just msbuild. There is no way to unselect the editor.

Is there a way I can install the latest version of msbuild without also installing the Visual Studio IDE?

4
  • Possible duplicate of TFS 2015 build task for VS 2017
    – Richard
    Commented Mar 9, 2017 at 13:43
  • 15
    That question is phrased with a bad title that hides the real question. It didn't come up in a search. Your answer is a link and run, which is bad. The number of views is low, and it's "newer" than this one in a way that won't matter a day from now, let alone next year. So sure, it's a "duplicate" in the worst possible sense.
    – rianjs
    Commented Mar 9, 2017 at 14:14
  • 3
    I disagree with the suggestion of a duplicate. I found this SO q&a as top result for my search for: "how to install msbuild 2017 on build server" - and the top answer addresses my need precisely. Having read the suggested duplicate, that answer is a full level more detailed about issues moving from one version to another - that SO post does not answer the question I searched for.
    – qxotk
    Commented Sep 28, 2018 at 15:26
  • Related post - Getting msbuild.exe without installing Visual Studio
    – RBT
    Commented Mar 4, 2020 at 11:49

2 Answers 2

333

The Visual Studio Build tools are a different download than the IDE. They appear to be a pretty small subset, and they're called Build Tools for Visual Studio 2019 (download).

You can 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\2019\BuildTools\MSBuild\Current\Bin.

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

15
  • 1
    The abovementioned directory is definitely not created. I've removed the --quiet flag with identical result, except for a modal window popping up for a bit before disappearing.
    – Itamaram
    Commented Mar 15, 2017 at 3:01
  • 6
    Also, dont use --quiet mode if you're building ASP.net web applications on your build server - as you will want to select "Web development build tools" during the install wizard so that the correct MSBuild targets are installed.
    – cwills
    Commented Apr 11, 2017 at 13:02
  • 38
    Looks like instead of build tools link refers to vs community. Here is buildtools link: aka.ms/vs/15/release/vs_buildtools.exe
    – lorond
    Commented Apr 26, 2017 at 9:13
  • 2
    @IamCP : to copy VS2017 installation environment into a local machine : cd G:\ISO; .\vs_Professional.exe --layout G:\ISO\VS2017ProOffline --lang en-US ; .\vs_BuildTools.exe --layout G:\ISO\VS2017BuildToolsOffline --lang en-US ; Then you can copy to your offline target. Commented Sep 12, 2017 at 13:09
  • 4
    I love how someone edited the answer to give a link to the Visual Studio 2019 build tools. Let's make this issue even more confusing. Commented Oct 16, 2019 at 20:20
5

For MsBuild 17, which is part of VS2022, you need to download the Build tools for VS2022 here (which is actually just the installer):

https://aka.ms/vs/17/release/vs_BuildTools.exe

(This link can be found by going to https://visualstudio.microsoft.com/downloads and scrolling all the way down to "Build Tools for Visual Studio 2022".)

Once downloaded you can install by typing:

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

Depending on your needs you might also need to specify --includeRecommended and possibly --includeOptional.

If you are doing web development you probably also want to add --add Microsoft.VisualStudio.Workload.WebBuildTools.

Input parameters and return codes are available here:

https://learn.microsoft.com/en-us/visualstudio/install/use-command-line-parameters-to-install-visual-studio?view=vs-2022

Not the answer you're looking for? Browse other questions tagged or ask your own question.