Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 364
user968441 Avatar asked Jun 30 '14 05:06

user968441


People also ask

What is the difference between MSBuild and Visual Studio build?

Visual Studio determines the build order and calls into MSBuild separately (as needed), all completely under Visual Studio's control. Another difference arises when MSBuild is invoked with a solution file, MSBuild parses the solution file, creates a standard XML input file, evaluates it, and executes it as a project.

Is it possible to build an application on a system if MSBuild is not installed?

Is it possible to build an application on a system if the MSBuild is not installed? If so, How? Yes, it is actually possible because the MSBuild doesn't depend on the Visual Studio of its operations. Users simply need to install the msbuild.exe file for this.

Is MSBuild included in .NET framework?

It is installed as part of . NET (Full Framework, not just Client Profile), you don't need SDK.

How do I run MSBuild locally?

To enable msbuild in Command Prompt, you simply have to add the directory of the msbuild.exe install on your machine to the PATH environment variable. You can access the environment variables by: Right clicking on Computer. Click Properties.


2 Answers

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.

like image 89
CarlR Avatar answered Sep 18 '22 17:09

CarlR


No, you don't need Visual Studio on your build box. If I recall correctly, msbuild is installed as part of the .NET framework - it certainly used to be.

Depending on what you're building, you may find that there are some things which are easier to get working if you do install Visual Studio though - things like portable class library profiles. While there are usually non-VS installers available, I've found it simpler to install an Express edition of Visual Studio just to get the bundled build targets.

like image 36
Jon Skeet Avatar answered Sep 16 '22 17:09

Jon Skeet