Does MSbuild require Visual Studio to be installed on the build server?

user968441 picture user968441 · Jun 30, 2014 · Viewed 43.2k times · Source

Can we use MSBuild without Visual Studio 2012?

Currently, we have a build server where we are compiling and creating deployment copy of one of our projects, it has Visual Studio Professional Edition installed. We are setting up a new build server now. Do we really need Visual Studio 2012 on the new build server?

If yes, then how? I googled it but I couldn't find an answer.

Answer

CarlR picture CarlR · Sep 29, 2014

We have spent a lot of time trying to get our Build Servers to work without Visual Studio. We do not use TFS for builds and therefore I am not sure the license exemption above applies to us. Also not having Visual Studio installed helps you really understand how your software is building and get references correct.

We have seen many examples of solutions with projects that contains references for the same piece of software with some in nuget packages shipped with the solution and others that are pointing to locations in the "program files" path which are not present on machines without Visual Studio installed. Once you attempt to build software without VS installed you can really see how "self-contained" your applications are.

Before I start listing the things you typically need to install, let me just point out that MS Build is now no longer considered part of the .NET framework but is shipped with Visual Studio but can also be installed separately. See this blog post for more: http://blogs.msdn.com/b/visualstudio/archive/2013/07/24/msbuild-is-now-part-of-visual-studio.aspx

The following software needs to be installed for most builds, there may be others for example if you are creating portable class libraries.

  1. Microsoft Build Tools 2013
  2. Web Deploy 3.5 (for packaging applications)
  3. Microsoft .NET Framework 4.5.1 Developer Pack
  4. Microsoft .NET Framework 4.5.2 Developer Pack
  5. Windows Software Development Kit (SDK) for Windows 8 (You can use the SDK to build applications that target these operating systems: Windows 8, Windows 7, Windows Vista, Windows Server 2012, Windows Server 2008 R2, Windows Server 2008)

The following directories need to be copied:

  1. Reference Assemblies (need to be copied from a machine running Visual Studio from/to directory C:\Program Files (x86)\Reference Assemblies)
  2. Public Assemblies (need to be copied from a machine running Visual Studio from/to directory C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PublicAssemblies

We also use Wix and therefore we install the following:

  1. WIX Toolset 3.8

I have a similar set for testing however that was not part of the question so I will leave that off!

Hope this helps someone.

Update: 3rd March 2017

Microsoft recently responded to a long standing user voice request "Support .NET Builds without requiring Visual Studio on the server" for the requirement for Visual Studio to be installed on a build server to be removed.

From the description on the download page "These Build Tools allow you to build native and managed MSBuild-based applications without requiring the Visual Studio IDE." Not tested yet but after RTM I will look at this and provide a further update here.

There is a blog post that promises these build tools install all pre-requisites and can be used to build MS Build based applications.