Today we are pleased to announce that MSBuild is now available on GitHub and we are contributing it to the .NET Foundation! The Microsoft Build Engine (MSBuild) is a platform for building applications. By invoking msbuild.exe on your project or solution file, you can orchestrate and build products in environments where Visual Studio isn’t installed. For instance, MSBuild is used to build the .NET Core Libraries and .NET Core Runtime open source projects.
The MSBuild sources we’re publishing today are closely aligned with the version we will ship with Visual Studio 2015. You may notice a few differences as this is our first attempt at a standalone build, but you should see those discrepancies reduced over time. And keep in mind that for now, you’ll need to have Visual Studio 2015 installed in order to build the first time.
We will be adding Linux and Mac support soon (perhaps with your help!) so you can use MSBuild to build the open source .NET projects on your preferred platform. We’ll initially start with Mono and look to port the code to run on .NET Core. But we’re really just getting started on our ports. We wanted to open up the code first, so that we could all enjoy the cross-platform journey from the outset.
Walkthrough
Build the Source Tree
The first scenario you might want to try is building the source tree. To do this, you will need to have Visual Studio 2015 installed on your machine. From a Developer Command Prompt, run the following:
git clone https://github.com/Microsoft/msbuild.git
cd msbuild
build.cmd
Build a Console App
To build an app, you’ll first want to run the BuildAndCopy.cmd script we included in the root folder of the source. This will build the sources and create a copy of your build output with everything you need. Again from a Developer Command Prompt, run this command from your MSBuild source location: BuildAndCopy.cmd bin\MSBuild true Now, to build a simple .NET Core console application, try the following:
cd ..\
git clone https://github.com/dotnet/corefxlab
.\msbuild\bin\MSBuild\MSBuild.exe .\corefxlab\demos\CoreClrConsoleApplications
\HelloWorld\HelloWorld.csproj
.\corefxlab\demos\CoreClrConsoleApplications\HelloWorld\bin\Debug\HelloWorld.exe

Summary
MSBuild is the default build engine for Visual Studio and the .NET community on the Windows platform. Through open sourcing MSBuild we are responding to community feedback and we intend to make it the best choice for .NET developers on the Linux and Mac platforms.
You can learn about the opportunities to get involved here. We look forward to your comments and hearing from you on the .NET Foundation Forums!


Awesome, will check this out after #dotnetconf where you just announced this! xD
Cool guys, awesome job!
That was cool to ask that question and to see it go live.
Unbelievable.
MSFT open sourcing things, on GitHub of all places. I'm never going to get over it.
MS is freeing a lot products. I hope they got the market right this time.
Can we get a open-source MSI.DLL, too, so we can build WiX installers for Windows on cross-platform build servers? I like using VS for development, but I'd rather have my CI server on Linux (easier to setup with monitoring solutions, git front-ends, etc). That way I could check in and for every commit I'd have a versioned installer.
Thanks!
I think MSBuild is really weird, so it will be useful to have the source available so I can better understand some of the magic. Looking forward to seeing this running on more platforms (I use OS X in my spare time).
This is great and totally unexpected.
Oh my god! What the hell happened
Cool! When will XNA be open-sourced and merged into Monogame?
visualstudio.uservoice.com/…/3725445-xna-5
visualstudio.uservoice.com/…/4233646-allow-net-games-on-xbox-one
Love the OSS work – keep it up!!
Good job on finally getting this out the door!
Now that it's open sourced and it runs on multiple platforms, don't you think that a name change is necessary? MS Build sounds like a Microsoft-only solution. Well it's not going to be a Microsoft-only solution and so perhaps rename it to XML Build?
this is great news. This should enable community to contribute and bring some great solutions for today's challenges
Wow, a big relief for VS SDK developers
What's the difference or relationship between MSbuild and Roslyn?
What's the difference or relationship between MSBuild and RoslynοΌ
@Allan Roslyn is the compiler system for C# (and VB) code. MSBuild is a build system; an orchestrator of tasks related to the build/test/package/publish process. In a C# project, MSBuild's build phase will use the C# compiler, which in VS 2015 will be Roslyn.
Great! Good timing, MSBuild is becoming the standard for .NET@Dow Jones. Being open source will make it easier to resolve issues in our deployment pipeline (and maybe result is some interesting 3rd party tooling/plugins)
So why I can't build a 10 years old product using a stable version of the IDE?
Awesome! π
Fantastic!
With MSBuild (at some point) being available on the same platforms as the CoreCLR, is it still wise to base the CoreCLR build on CMake? Perhaps that decision should be regarded as a stopgap measure to get things going.
(Yes, that would present an interesting bootstrapping problem, where building the CLR requires the CLR, but that is pretty much the situation on Windows anyway.)
And yet Microsoft still won't open source the VB6 programming language, IDE and runtime.
This is a big step for MSFT. Congratulations for you guys.
Does this mean that MSBuild will also now run on Windows OSs previous to Windows 2008 R2?
Neat.
Built it with vs2013 no problem.
This code includes great examples of unit tests.
Does this mean I can now fix your bugs? π
@Open source VB6 programming
To be honest, I wouldn't want it open sourced if I had to figure out how everything worked; I would want them to take the time to write up documentation on the source, just like Immo Landworth said would need to be done when this came up the last time. I also suspect that the people on the outside that would be needed to maintain it aren't the ones that are asking for it to be open sourced, just as he also pointed out.
@Paul Cox It's possible that msbuild will be made to work on other Windows OSes. If it is being made to work on Linux and OS X, then it would seem like other versions of Windows would be an option. It's all a question of what the community wants to go after and which PRs the mbuild team will accept.
@Semi Essessi You do now indeed have the option to fix "our bugs". The team is working on msbuild every single day. If they don't get to the bugs you care about, you've now got a new option for resolving it. In general, I think that's an improvement.
@dfellman glad it worked for you.
@David we will use msbuild for corefx but plan to stay with CMake for CoreCLR. We may go into more depth on that choice in a later post.
@Rich, a post on MSBuild vs. CMake would be really interesting, especially knowing if the (current) lack of x-plat support for MSBuild was a driving factor for the decision, or something else.
The obvious downside with the current solution, from my point of view, is the complex build mechanics on Windows, with CMake generating throw-away MSBuild projects. It would be much more interesting if MSBuild in general had an x-platform strategy for C# AND C++ (clang/llvm, most likely) projects, that CoreCLR could utilize once it was ready. There is a reason why MSBuild, after all, is quite popular. Don't be shy to promote your own inventions! π
Guys, i love you all … from deep down, inside my heart, i love you, all, every employee/coder that added a character (including whitespace) to each file and every PM that lead it …. LOVE EVERYWHERE <3
Great to see Microsoft Development tech in Git Hub.
@soundararajan,
I would like to learn more on how having MSBuild as OSS is going to help you as a VS SDK developer. Could you please follow up directly with me by email at selmai AT Microsoft DOT com?
Thanks.
FANTASTIC!!! This is awesome news! I know I for one would like to see MSBuild move AWAY from the antiquated XML (with absolutely terrible designer and tooling support) and get upgraded to Xaml (with free built-in designer and AWESOME tooling support). I would love to work on something like this as a PR. π
Great work MSFT!!!
Really cool step with MSBuild source as open source.
I was wondering if it would make sence to take it a step further. Setup a CI build that runs on AppVeyor on every commit to Master and then publishes the new version of MSBuild to Chocolatey?
This would make it easy to continiously update the MSBuild agent on any windows build server π
Hey @Christian – we have a Jenkins based CI build server set up for MSBuild here: dotnet-ci.cloudapp.net/…/microsoft_msbuild
We deliberately don't publish CI builds as stable release builds, but we are looking at ways of making it easy for projects to publish more often into a "latest" rather than "stable" or "supported" feed to make it easy for folks like you who would be happy to run on the bleeding edge.
So when can I get the source code for the Surface Pro 3 and print it out using a 3D printer. Call me when it's ready!
lux-case.se/microsoft.html
So will this be replacing xbuild for mono on Linux/Mac? Any idea what the timetable is for getting this ported to those platforms?
What about this? http://www.screencast.com/…/jd52wS5XeR3
As we continue developing PVS-Studio static code analyzer, we often have to check large open-source projects by renowned developers. The fact that even such projects contain a certain amount of bugs adds even more sense and weight to our work. Unfortunately, everybody makes mistakes. No matter how carefully you control your code’s quality, there is just no way to avoid “human error”. As long as software is developed by humans, analysis tools like PVS-Studio will remain relevant and needed. Today, we are going to discuss errors found in the source code of MSBuild: http://www.viva64.com/en/b/0424/