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?

Martin Hollingsworth
  • 7,249
  • 7
  • 49
  • 51
rianjs
  • 7,767
  • 5
  • 24
  • 40
  • Possible duplicate of [TFS 2015 build task for VS 2017](http://stackoverflow.com/questions/42694100/tfs-2015-build-task-for-vs-2017) – Richard Mar 09 '17 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 Mar 09 '17 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 Sep 28 '18 at 15:26
  • Related post - [Getting msbuild.exe without installing Visual Studio](https://stackoverflow.com/q/25506178/465053) – RBT Mar 04 '20 at 11:49

2 Answers2

332

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.

Ian Kemp
  • 28,293
  • 19
  • 112
  • 138
rianjs
  • 7,767
  • 5
  • 24
  • 40
  • 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 Mar 15 '17 at 03:01
  • 1
    I would have a look at the Windows Event Viewer to see if there are any log messages about why the installation failed. And then correct those or ask a new question that's specific to your problem. – rianjs Mar 15 '17 at 12:35
  • 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 Apr 11 '17 at 13:02
  • 37
    Looks like instead of build tools link refers to vs community. Here is buildtools link: https://aka.ms/vs/15/release/vs_buildtools.exe – lorond Apr 26 '17 at 09:13
  • @rianjs, I installed this on my build server(Bamboo), however when solution gets built, it throws error `MSB4019: The imported project "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Sdks\Microsoft.NET.Sdk.Web\Sd‌​k\Sdk.props" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.` unable to understand why it still doesn't find this path. – Avi Kenjale Jun 06 '17 at 14:14
  • I installed this and package restore via NuGet does not seem to work. Any one else experience this? – Dib Jun 07 '17 at 14:19
  • 1
    Is there an offline version of this ? My build server has no internet access. – LazyProgrammer Jul 31 '17 at 05:24
  • 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. – Michel de Becdelièvre Sep 12 '17 at 13:09
  • unfortunately at the moment MSBuild from the suggested package is affected by [this issue](https://developercommunity.visualstudio.com/content/problem/25594/visual-studio-build-tools-2017-is-missing-msbuild.html), which manifests itself with `The SDK 'Microsoft.NET.Sdk.Web' specified could not be found`. Please upvote the issue, so that M$ finally fixes it. – morgwai Sep 12 '17 at 15:47
  • --quiet flag failed for me. The Installer folder was there but no other folders where the msbuild should have been. I was able to confirm by digging in the log, which is in c:\users\[username]\appdata\local\temp. The error was saying that it could not find the component specified Microsoft.VisualStudio.Workload.MSBuildTools. It did seem to work ok in --passive mode though. weird. – Michael Adamission Mar 02 '18 at 02:20
  • I'd guess this _isn't_ "much quicker than the full IDE." If you had `vs_buildtools` available, you already had the dotnet framework installed. On a server without a current dotnet, it just spent 20 minutes installing the framework, and is currently taking its time with dotnet core. If you'd installed the full Visual Studio, on a new system, it would have had to do all that, too. Still, I got what I needed from the answer :-) – Auspex Sep 12 '18 at 13:06
  • I did not use quiet and it came up with the gui and an option which was 71MB and previously unavailable. But after that had been displayed I had to press Install to continue. Seemed to work ok. Thanks. – blissweb Feb 09 '19 at 07:34
  • I need to install it on a build server which does not have internet connection. Is there anyway to download it for offline installation? – developer Jul 11 '19 at 13:51
  • 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. – gravidThoughts Oct 16 '19 at 20:20
  • I wanted a GUI-less terminal only solution, but `--quiet` mode is not very good: it returns very quickly, and the installation continues in background process `vs_installerservice.exe` and you have no way to know the progress (1% ? 100%? 50%? failed?). Here there is no verbosity at all :( – Basj Jun 24 '20 at 12:01
4

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

Rocklan
  • 7,888
  • 3
  • 34
  • 49