How can I install the VS2017 version of msbuild on a build server without installing the IDE?
Solution 1
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.
Solution 2
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:
Related videos on Youtube
rianjs
Delivery-focused software developer. I really enjoy working at the intersection of computer science and operations research.
Updated on July 08, 2022Comments
-
rianjs almost 2 years
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?
-
Richard about 7 yearsPossible duplicate of TFS 2015 build task for VS 2017
-
rianjs about 7 yearsThat 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.
-
qxotk over 5 yearsI 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.
-
RBT about 4 yearsRelated post - Getting msbuild.exe without installing Visual Studio
-
-
Itamaram about 7 yearsThe 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. -
rianjs about 7 yearsI 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.
-
cwills about 7 yearsAlso, 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. -
lorond about 7 yearsLooks like instead of build tools link refers to vs community. Here is buildtools link: aka.ms/vs/15/release/vs_buildtools.exe
-
Avi Kenjale almost 7 years@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\Sdk\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. -
Dib almost 7 yearsI installed this and package restore via NuGet does not seem to work. Any one else experience this?
-
LazyProgrammer over 6 yearsIs there an offline version of this ? My build server has no internet access.
-
Michel de Becdelièvre over 6 years@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.
-
morgwai over 6 yearsunfortunately at the moment MSBuild from the suggested package is affected by this issue, 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. -
Michael Adamission about 6 years--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.
-
Auspex over 5 yearsI'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 :-) -
blissweb about 5 yearsI 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.
-
developer almost 5 yearsI need to install it on a build server which does not have internet connection. Is there anyway to download it for offline installation?
-
gravidThoughts over 4 yearsI 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.
-
Basj almost 4 yearsI wanted a GUI-less terminal only solution, but
--quiet
mode is not very good: it returns very quickly, and the installation continues in background processvs_installerservice.exe
and you have no way to know the progress (1% ? 100%? 50%? failed?). Here there is no verbosity at all :(