Should I switch from nant to msbuild?


I currently use nant, ccnet (cruise control), svn, mbunit. I use msbuild to do my sln build just because it was simpler to shell out.

Are there any merits to switching my whole build script to MSBuild? I need to be able to run tests, watir style tests, xcopy deploy. Is this easier?

Update: Any compelling features that would cause me to shift from nant to msbuild?

8/23/2008 3:11:26 PM

Accepted Answer

I like MSBuild. One reason is that .csproj files are msbuild files, and building in VS is just like building at the command line. Another reason is the good support from TeamCity which is the CI server I've been using. If you start using MSBuild, and you want to do more custom things in your build process, get the MSBuild Community Tasks. They give you a bunch of nice extra tasks. I haven't used NAnt for several years now, and I haven't regretted it.

Also, as Ruben mentions, there are the SDC Tasks tasks on CodePlex.

For even more fun, there is the MSBuild Extension Pack on CodePlex, which includes a twitter task.

8/14/2009 9:25:38 PM

The most compelling reason to use MSBuild (at least in .NET 3.5 and beyond) - the build engine can build concurrently.

This means a huge speed up in your builds in you have multiple cores/processors.

Previous to 3.5, MSBuild didnt do parallel builds.


I feel that MSBuild and Nant are fairly comparable. If you are using one of these, I generally wouldn't switch between them unless there was a compelling feature that was missing in the product you had selected.

I personally use MSBuild for any new project, but your mileage may vary.

Hope that helps!

Edit: @ChanChan - @Jon mentions that Nant doesn't build .NET 3.5 applications. This may be enough of a reason to either change, or at least use them in parallel. As I've moved more towards MSBuild, I am probably not the most informed person to highlight any other showstoppers with either technology.

Edit: It appears Nant now builds .NET 3.5 Applications.


NAnt has been around longer, and is a considerably more mature product, and also IMO easier to use. There is a lot of community know-how out there to tap into, and it is also cross-platform, should you be interested in building apps that can run under Mono as well as .NET and Silverlight. Out of the box, it does a whole lot more than MSBuild does. Oh yes, and you can call MSBuild from NAnt (OK, from NAntContrib) :-)

On the negative side, NAnt and its sister project NAntContrib do seem to have stagnated, with the most recent update being late 2007.

The main advantages that I see of MSBuild is that it ships with the .NET Framework, so it's one less product to install; and there is more active development going on (albeit in places to catch up with the older NAnt).

Personally, I find its syntax a little more difficult to pick up, but then I'm sure continued exposure to ti would make things easier.

Conclusion? If you're working with existing NAnt scripts, stick with them, it's not worth the hassle of porting. If you're starting a new project, and you're feeling adventurous, then give MSBuild a go.


We also switched from nant to msbuild. If Your build is pretty standard, then You won't have much problems setting it up, but if You have a lot of specific build tasks, You will have to write custom ms build tasks, as there are way less custom tasks for msbuild.

If you want to display reasonable build results, You will have to mess with custom loggers etc. The whole team build is not as ripe as nant is.

But the real benefit is integration with TFS source control and reporting services. If You are not using TFS as Your source control system, it's not worth it.


  • Don't switch unless you have a very convincing reason (at least).
  • NAnt is open source and if it weren't I wouldn't be able to customize our build system, MSBuild is not.
  • NAnt can easily run MSBuild, I'm not sure about the other way around.
  • MSBuild scripts are already written for you if you use VS2005 or newer (the project files are MSBuild files.)
  • If you use NAnt, and you use VS to edit project files, settings and configurations, you'll have to write a converter/sync tool to update your NAnt files from the VS Project files.

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Email: [email protected]