views:

697

answers:

6

I work on a project with 4 other devs. We currently use Visual Studio to build our solution with some Pre and Post build events.

I would like to move to a more powerful build system such as Nant or MsBuild.

What are the pros and cons of the two approaches?

How is the developer experience using Nant/MsBuild? Is it easy to debug the application by pressing F5? Is there still a nice list of files in the solution explorer? Or do I need to get into an XML file every time I need to add a .cs file to my project?

How does this all integrate with Source Control? (I'm currently using SourceGear Vault.)

I'm trying to gather enough information so that I can make an informed decision.

Thanks!

+3  A: 

One thing to note. If you're using VS2005 or later, with the exception of C++, you're already using MsBuild. The .csproj and .vbproj files are actually MsBuild files under the hood. VS hosts MsBuild in order to do a build.

I can't provide much / any feedback about Nant though.

JaredPar
What about adding custom build tasks to the .csproj? Surely that can't be done through the Solution Explorer...?
Peter Stephens
@Peter, no. But you can add them directly into the .csproj files.
JaredPar
Thanks @Jared. That helps to clue me in.
Peter Stephens
Found documentation on Visual Studio / MsBuild here: http://msdn.microsoft.com/en-us/library/ms171468(VS.80).aspx
Peter Stephens
If you right click the Project and select unload project, you can then click edit project. This will open the project in visual studio, so you can edit it and add custom msbuild events. Then just save and click load project.
daub815
+1  A: 

Use CruiseControl.NET to automate your build process.MSBuild is easier to hook up than NANT,MSBuild is found in .NET Framework folder.SGear has plugins for CruiseControl.NET,there are task plugins you can write and download for MSBuild....

abmv
We're actually using CruiseControl.NET now to make nightly builds. But we need to fine tune and automate the process more.
Peter Stephens
+2  A: 

I use nant for my build scripts and find it reliable and well supported. At this point, msbuild and nant seem even in a lot of respects. Msbuild has some advantages in that is it is used by Visual Studio, so it is a built-in part of the platform. However, nant has a lot of functionality, add-in tasks and a large community, since it has been around longer.

Nant has plug-ins for most all source code control providers - including Vault - and has hooks for most build tools such as CruiseControl.NET and TeamCity.

The developer experience is a little different than just pressing F5. Generally, the nant or msbuild files encompass a lot of functionality you normally wouldn't run during the normal, quick compilation. The scripts are used to run tests, run build tools (such as FxCop or StyleCop), update/commit working copies, tag source code, create/update/populate databases and building installers or packages. Not all of these things are done at every compile. This is where build scripting tools provide the most benefit and are done outside the purview of Visual Studio.

I think you will be happy with either one. If you are using mostly MS tools, msbuild may be more seamless. On the other hand, nant may be a good choice if you are using many open source tools, which often use nant.

Steven Lyons
+2  A: 
Curt Sampson
Well, maybe Nant/MsBuild will help, but not without some pain.As an aside, I've heard of a build system based on Ruby. That sounds interesting to me because you then have a real language at your fingertips and you don't have to pay the angle bracket tax.
Peter Stephens
here's a link to the Ruby build system called Rake: http://rake.rubyforge.org/
Peter Stephens
As it happens, my current build system is built in Ruby. It's a pretty decent language, and it works well in Windows, too. So yes, please give Rake a go.
Curt Sampson
After getting up to speed with MsBuild, I believe it will significantly improve my build process while also keeping my project relatively user friendly and easy to maintain (in the VS IDE). MsBuild uses the exact same dialect as the project file--the .csproj file is actually an MsBuild file.
Peter Stephens
The main problem I am seeing is that MsBuild is like programming in XML. Not so nice. On the other hand I can understand why XML is used because it is highly machine readable and writable. How would a tool like Visual Studio pull in a rake file, allow editing of the main project properties, and then write the rake configuration back out with out destroying all the customizations within the rake file? Not possible as far as I know. But with XML it is possible.
Peter Stephens
It's certainly possible to do that with Rake files as well, just more difficult. That said, it's not likely ever to happen.
Curt Sampson
A: 

Found a useful thread on Nant vs MsBuild here.

Peter Stephens
+1  A: 

I used to use Nant, more recently I've taken to using MSBuild.

Like you I'm a Vault Sourcegear users as well and as you'll have discovered there are no MSBuild tasks for Vault .... or are there?

I have the source code in my possession for some MSBuild tasks for using with Vault. They work quite well and are based on a port from the NANT tasks (at which point/date I don't exactly know).

They came into my possession from a guy who had done the porting and was intending to open source them on SourceForge/CodePlex or some such. But alas he got married and then couldn't be bothered.

I begged him for the code and he emailed it to me ... I have since sat on the code without the spare time or inclination to have bothered to return them to the public domain where they would be loved.

If anyone's interested in them I'm quite happy to see them go to a better home

:p

http ==> img269.imageshack.us/img269/4467/msbuildsourcegearvaultt.png

Jason Glover
Looks interesting. I'm not sure that I have any immediate need to integrate the build system with Vault. That said, I use cruisecontrol.net which does seem to integrate with Vault OK.
Peter Stephens