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

7

59

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.

Samsara answered 30/6, 2014 at 5:45 Comment(3)
Your search does not return the results you wanted for a reason. That is, whether you can build without VS fully depends on your projects. Microsoft does have MSBuild (even MSBuild 12) available alone, as well as many other components (various SDKs, such as Silverlight SDK) you might use. However, there are still components solely available with VS (like MSTest). Thus, it is impossible for anyone to draw a conclusion. You might follow the answers but soon your projects might bite you badly.Gogetter
99% of the time, you can build with msbuild and without visual studio installed. I say 99%, because sometimes you run into a weird situation. I do NOT like to install visual studio (any version of it) on the build-machine, because it installs so many things in the GAC that sometimes result in a build-working, but not getting packaged up for distirbution correctly. Having said that, sometimes it is a pain to get it working without visual studio. Here is an example of that: #15556839Distortion
One of the 1% of the times was IBM Rules Engines, they could only build their custom dotnet application type...with devenv.exe...(it was documented on their site). They have since deprecated that product.....but just showing that every blue moon, you hit an exception to msbuild "only".Distortion
G
40

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.

Gruchot answered 30/6, 2014 at 5:54 Comment(13)
Thanks Jon for your quick response. I understand that msbuild is part of .NET framework but in Framework 4.5; i read it somewhere. But Since our application is developed in Framework 4.0 does it work over there?? I mean do we need to install any prerequisites for same.Samsara
@user968441: It's been part of the framework since .NET 2 shipped.Gruchot
MSBuild 12 is in a standalone package. Consider that MSTest and so on are only installed along with Visual Studio, it is rather hard to say without Visual Studio everything can be done with raw MSBuild. Such extra bits are unfortunately not always in VS Express.Gogetter
@LexLi: Well MSTest is only going to be a problem if that's your test framework. Plenty of people use NUnit, xUnit etc. It really does depend on what the "and so on" is, and whether the OP's build requires it.Gruchot
Thanks Jon for helping me out...Now it confirms that MsBuild doesn't require any IDE installed on build box. Thanks a lot. :)Samsara
@JonSkeet Any definitive documentation on the difference between MSBuild and the Visual Studio Build options - such as the class library profiles you mentioned? Also, given the purpose is for build and test, is another Visual Studio license required for build server installation? Thanks ahead of time.Charland
@one.beat.consumer: I'm not sure exactly what you're looking for. It's really a matter of installing the right things. If you did have Visual Studio on the build server, it would need to be licensed appropriately. There's definitely no point in trying to come up with a "definitive" set of differences given how often the situation changes.Gruchot
@JonSkeet Thanks for the reply. I'm not sure how to better phrase my question, but one explicit goal is to facilitate the new Bug items when XUnit tests fail at check-in (CI). With VS on the TFS box, tests are run during build and can be used to fail the build, but they do not create Bugs/Tasks like MSTest did with it's own element in the build process. This is worthy of its own post?Charland
@one.beat.consumer: Yes, I think so.Gruchot
Thank you @JonSkeet. I went ahead and created two: one for the XUnit issue, and another for an error on the Release setup regarding a missing drop in container. We'll see where those go.Charland
The new Build Tools for Visual Studio 2017 RC are lessening the requirement to install Visual Studio.Erdrich
@GiulioVian - I have two questions. 1.) Is there also any categorization i.e. Professional, Enterprise in Visual Studio Build Tools? If yes, then we have to purchase a license. Or we can use it for free for commercial purpose. 2.) Does it include MSTest?Nozzle
@AnkushJain shortly licensing is a completely different issue and I suggest to look at this Q #780104. The license depends also on the type of software: commercial requires a license, while non-commercial open source does not. As per Q#2, the testing platform is now a NuGet package and is the reccommended way (see github.com/microsoft/vstest)Erdrich
S
60

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.

Sanfordsanfourd answered 29/9, 2014 at 13:26 Comment(6)
What are you using for testing?Shaft
Another attempt: nickberardi.com/a-net-build-server-without-visual-studioAdulterate
I have toke a try and note down something here: gist.github.com/lijunle/7cc5c3e5743d3a494b83 Hope someone could get help from it.Adulterate
For those that need the newer version, Microsoft Build Tools 2015 are at: microsoft.com/en-in/download/details.aspx?id=48159Spruill
VS Build Tools does not include MS Fakes generating support.Iodometry
I'm using Build Tools 2017, but the Test Assemblies task fails. Indeed, trying to figure out how to solve these issues, I'm almost giving up and installing the full IDE on the server, which in fact is not desired.Carlitacarlo
G
40

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.

Gruchot answered 30/6, 2014 at 5:54 Comment(13)
Thanks Jon for your quick response. I understand that msbuild is part of .NET framework but in Framework 4.5; i read it somewhere. But Since our application is developed in Framework 4.0 does it work over there?? I mean do we need to install any prerequisites for same.Samsara
@user968441: It's been part of the framework since .NET 2 shipped.Gruchot
MSBuild 12 is in a standalone package. Consider that MSTest and so on are only installed along with Visual Studio, it is rather hard to say without Visual Studio everything can be done with raw MSBuild. Such extra bits are unfortunately not always in VS Express.Gogetter
@LexLi: Well MSTest is only going to be a problem if that's your test framework. Plenty of people use NUnit, xUnit etc. It really does depend on what the "and so on" is, and whether the OP's build requires it.Gruchot
Thanks Jon for helping me out...Now it confirms that MsBuild doesn't require any IDE installed on build box. Thanks a lot. :)Samsara
@JonSkeet Any definitive documentation on the difference between MSBuild and the Visual Studio Build options - such as the class library profiles you mentioned? Also, given the purpose is for build and test, is another Visual Studio license required for build server installation? Thanks ahead of time.Charland
@one.beat.consumer: I'm not sure exactly what you're looking for. It's really a matter of installing the right things. If you did have Visual Studio on the build server, it would need to be licensed appropriately. There's definitely no point in trying to come up with a "definitive" set of differences given how often the situation changes.Gruchot
@JonSkeet Thanks for the reply. I'm not sure how to better phrase my question, but one explicit goal is to facilitate the new Bug items when XUnit tests fail at check-in (CI). With VS on the TFS box, tests are run during build and can be used to fail the build, but they do not create Bugs/Tasks like MSTest did with it's own element in the build process. This is worthy of its own post?Charland
@one.beat.consumer: Yes, I think so.Gruchot
Thank you @JonSkeet. I went ahead and created two: one for the XUnit issue, and another for an error on the Release setup regarding a missing drop in container. We'll see where those go.Charland
The new Build Tools for Visual Studio 2017 RC are lessening the requirement to install Visual Studio.Erdrich
@GiulioVian - I have two questions. 1.) Is there also any categorization i.e. Professional, Enterprise in Visual Studio Build Tools? If yes, then we have to purchase a license. Or we can use it for free for commercial purpose. 2.) Does it include MSTest?Nozzle
@AnkushJain shortly licensing is a completely different issue and I suggest to look at this Q #780104. The license depends also on the type of software: commercial requires a license, while non-commercial open source does not. As per Q#2, the testing platform is now a NuGet package and is the reccommended way (see github.com/microsoft/vstest)Erdrich
B
16

Remember: The easiest way to build your visual studio solutions is to install Visual Studio on the build server. Even Visual Studio Express is often enough.

That said, you can make it work without it. But it it sometimes a lot of work to figure out. You'll need to install the right Windows / .NET Platform SDK. You can install multiple of these SDKs side by side. Now, when you depend, for example, on ASP.NET MVC 5 or Entity Framework 6, you might need to install further SDKs to get your application to compile. The downloads for these all assume that you also have Visual Studio installed, but many of their payloads can also be installed separately. It can become quite a hassle.

Personally I've grown tired of trying to figure out which parts of which installers enable what. But that is also driven by the fact that Microsoft allows you to install Visual Studio on a build server (TFS) with the same license as your development machine as long as you are an MSDN subscriber. Check the Visual Studio License Whitepaper for more details.

Using Visual Studio on the Build Server

If you have one or more licensed users of Visual Studio Ultimate with MSDN, Visual Studio Premium with MSDN, or Visual Studio Professional with MSDN, then you may also install the Visual Studio software as part of Team Foundation Server 2013 Build Services. This way, you do not need to purchase a Visual Studio license to cover the running of Visual Studio on the build server for each person whose actions initiate a build.

If you, like me, would prefer this to change in the future, I suggest you make sure you're heard by submitting your request or voting for an existing one over at the Visual Studio User Voice.

Bidet answered 30/6, 2014 at 6:9 Comment(1)
That's said. One needs to install an IDE on a build server to make things work. Somethings is wrong here.Morphinism
S
7

Here's just a quick take on this.

Your build machine should decouple development tools as much as is possible. With that said, and as already stated by others here, MSBuild can be run independently of Visual Studio, and it should!

If your build requires Visual Studio to run then there is a very good chance that you have a solution or project architecture problem that ought to be resolved.

Snowfall answered 1/6, 2015 at 20:2 Comment(0)
J
0

Visual Studio doesn't need to be installed. MSBuild is part of the .net SDK.

Other .net dependencies will need to be installed though, if you are using them. MSTest, or anything that is part of Team foundation will require Visual Studio installed.

Josi answered 30/6, 2014 at 7:4 Comment(1)
It is not part of .NET any more.Tremolite
H
0

I believe you only need MSBuild ( that is part of the .NET framework you're targeting ) .

Make sure you install the proper .NET distribution

the following is a good place for build servers it have the developer tooling.

The .NET Framework 4.5.1 Developer Pack installs the multi-targeting pack for .NET Framework 4.5.1. Developers can build applications targeting the .NET Framework 4.5.1 using either Visual Studio 2012 or third party IDEs. You need to download the web installer instead of this package if you intend to redistribute .NET Framework 4.5.1.

http://www.microsoft.com/en-us/download/details.aspx?id=40772

Best of luck.

Heaveho answered 17/3, 2015 at 12:33 Comment(0)
F
0

C++ :

There is a "Build Tools" that contains MSBuild, Visual studio is not required.

From the official doc :

These tools allow you to build C++ libraries and applications targeting Windows desktop. They are the same tools that you find in Visual Studio 2015 in a scriptable standalone installer. Now you only need to download the tools you need to build C++ projects.

Managed :

The same applied : Build Tool Managed

Freddyfredek answered 17/10, 2017 at 21:58 Comment(1)
I think that the above link is now broken. The VS2017 equivalent can currently be found here visualstudio.microsoft.com/downloads/…Superphosphate

© 2022 - 2024 — McMap. All rights reserved.