I am involved with maintaining a fairly large portfolio of .NET applications. Also in the portfolio are legacy applications built on top of other platforms - native C++, ECLIPS Forms, etc.

I have a complex build framework on top of NAnt right now that manages the builds for all of these applications. The build framework uses NAnt to do a number of different things:

Pull code out of Subversion, as well as create tags in Subversion

Build the code, using MSBuild for .NET or other compilers for other platforms

Peek inside AssemblyInfo files to increment version numbers

Do deletes of certain files that shouldn't be included in builds / releases

Releases code to deployment folders

Zips code up for backup purposes

Deploy Windows services; start and stop them

Etc.

Most of those things can be done with just NAnt by itself, but we did build a couple of extension tasks for NAnt to do some things that were specific to our environment. Also, most of those processes above are genericized and reused across a lot of our different application build scripts, so that we don't repeat logic. So it is not simple NAnt code, and not simple build scripts. There are dozens of NAnt files that come together to execute a build.

Lately I've been dissatisfied with NAnt for a couple reasons: (1) it's syntax is just awful - programming languages on top of XML are really horrific to maintain, (2) the project seems to have died on the vine; there haven't been a ton of updates lately and it seems like no one is really at the helm. Trying to get it working with .NET 4 has cause some pain points due to this lack of activity.

So, with all of that background out of the way, here's my question. Given some of the things that I want to accomplish based on that list above, and given that I am primarily in a .NET shop, but I also need to build non-.NET projects, is there an alternative to NAnt that I should consider switching to?

Things on my radar include Powershell (with or without psake), MSBuild by itself, and rake. These all have pros and cons. For example, is MSBuild powerful enough? I remember using it years ago and it didn't seem to have as much power as NAnt. Do I really want to have my team learn Ruby just to do builds using rake? Is psake really mature enough of a project to pin my portfolio to? Is Powershell "too close to the metal" and I'll end up having to write my own build library akin to psake to use it on its own?

Are there other tools that I should consider? If you were involved with maintaining a .NET portfolio of significant complexity, what build tool would you be looking at? What does your team currently use?

This question appears to be off-topic. The users who voted to close gave this specific reason:

"Questions asking us to recommend a tool, library or favorite off-site resource are off-topic for Programmers as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – gnat, GlenH7, MichaelT, Dan Pichelman, mattnz

9 Answers
9

If you're already using TeamCity, you should be able to use its existing features for most of what you need. It natively supports building Visual Studio .sln files and if you need extra stuff done to all of your projects, you can modify the .NET Framework's .targets files on your build machines, so you don't have to alter individual csproj files.

It will automatically check out from Subversion, zip artifacts, allow you to control which files are considered deployable artifacts. The new version (6.0) also allows multiple build steps, so there's opportunity for xcopy deployment of artifacts to a share.

You can also write your own apps/tasks that can run as part of a build (via the command-line runner) and do anything you want (such as start/stop Windows processes).

Thanks for the info on MSBuild. It seems there is more power there than the last time I tried to use it. Regarding Hudson, does this provide benefit beyond what other CI servers provide, such as TeamCity, which we currently use? I'm trying to avoid upsetting too much of the status quo here, and replacing our CI server at the same time we replace our build scripts seems more painful.
–
RationalGeekJan 4 '11 at 15:29

In my humble opinion, I think that TeamCity is fantastic... and hudson is better. They can be seen to perform the same functions, until you want to do something awesome - then hudson wins. Honestly, hudson can analyze(stylecop/fxcop)->build->test->tag->local and offsite backup->deploy while keeping you up to date via RSS, SMS, XFD's.
–
Steve EversJan 4 '11 at 15:39

Hmm...nothing in that list is impossible with TeamCity, but perhaps it is easier with Hudson. Either way, unless we hit some pain points with TC I don't think we'll switch anytime soon.
–
RationalGeekJan 4 '11 at 18:52

@jkohlhepp: The difficulty is that there are many many solutions in the same space. At the end of the day, hudson is easy and is 100% free. IIRC, one thing that TC might have on hudson is multi-agent building.
–
Steve EversJan 4 '11 at 21:15

The only reason why I don't switch to 100% MS Build or Team Foundation Build is the cost it will involve to rebuild the scripts that works perfectly today. The scripts don't change much...

However, for the next product, this will be Team Foundation Build without any hesitation for the main following reasons (they are many more):

It's easy to deploy (latest version: 2010)

It's fully integrated with Visual Studio and Team Foundation Server

It's becoming a standard like MS Build

It's free with Bizspark (for startups)

Since you are in .NET also, I warmly recommend you to use TFB.

If you can't apply for Bizspark or can't afford to purchase the license, you can go for CruiseControl.NET + MS Build and few support scripts. At a large utility company I worked for, we had used CruiseControl.NET to build, test, deploy and report all our projects. It included automatic web service deployment.

I had not considered this option, but I don't think it would be a realistic option for us since we are not using TFS at all, and have vetoed attempts to move to it in the past (for budget and other reasons). But thanks for the suggestion that is an interesting idea.
–
RationalGeekJan 4 '11 at 15:16

It's not that expansive. If your management is price sensitive, MS Build will be a perfect match. I used to work with MS Build + CruiseControl.NET only and it worked great! Will add that in my answer.
–
user2567Jan 4 '11 at 15:18

@Pierre 303: For curiosities sake, why do you want to get rid of Automated Build Studio?
–
RationalGeekJan 4 '11 at 15:24

@Pierre 303: The expense of TFS is not the only concern. My shop is part of a larger enterprise, and they have standardized on Subversion and other tools and being "non-standard" and going with TFS causes political issues.
–
RationalGeekJan 4 '11 at 15:25

@jkohlhepp: it's not easy to use, it's not well integrated with Visual Studio (at least the version I have) and it's far from being a standard.
–
user2567Jan 4 '11 at 15:27

We approach things as three different activities, Build, Deploy and Install. We use TFS for the build server with a few callouts to Powershell. We then use Powershell to accomplish all of the Deploy and Install pieces which are fairly complex and across multiple servers both local and cloud. I have been very happy with learning Powershell over MSBuild or some other tool. I have also had good experience with Visual Build in the past.

I am currently doing what you are doing (i.e from build to packaging to deployment) using MSBuild (>3000 lines of scripts). The CI is using CruiseControl.Net and hopefully I can move to TeamBuild in future. MSBuild is cumbersome (programming in XML) but it is quite powerful specially the batch processing and dependency tracking. It is actively maintained and improved in new .Net versions and is the basis of build system in Visual Studio and TFS. Also visual studio project files are actually MSBuild projects and I can hook into various extension points. The MSBuild extension pack has many additional tasks and it is trivially easy to create your own tasks programatically. I suggest give MSBuild a serious thought. Lately I am also learning powershell and finding it easy for certain tasks specially in the deployment phase, like installing and configuring certificates, IIS etc.

Edit MSBuild project in VisualStudio as it understands the syntax and gives you intellisense.Here are some other good utilities that will help with MSBuild.MSBuild Launch Pad - For shell extensionsMSBuild SideKicks - Graphically edit, execute and debug scripts.

Perhaps you are asking too much of your build script and not enough of your build server -- with team city, you could easily have simple scripts which accomplish each of your bullets, in whatever language or stack that makes sense and use TeamCity build tasks to chain things together as appropriate.

It seems that most of these answers are equating CI with build scripts. I had always considered build scripts to be the smarts, and the CI server to be the thing that just kicks off builds based on triggers. But maybe you are right and I do need to rethink this.
–
RationalGeekJan 4 '11 at 15:40

I strongly recommend TeamCity, it is easy to configure and setup. MSBuild is preferable over NAnt for simple reason that all the project/solution files in the vs2008/2010 are MSBuild files technically, but you can configure TeamCity with MSBuild or NAnt.

OfCourse, TeamCity will cost you. I personally given a choice would prefer rake, simply because the friction with Ruby tools compared to other even though psake is also a good candidate.

FYI TeamCity is free if you have less than 20 build configurations and less than 20 users. Also, if you are an open source project you can apply to them for a free unlimited license.
–
RationalGeekJan 4 '11 at 17:58

Hudson is more of a continuous integration platform, and not really a build platform. We do have a CI server in place - TeamCity, which works fine with NAnt. However, the reasons I want to replace NAnt are because maintaining the NAnt scripts is painful. Using the current scripts through Hudson doesn't solve this problem. Thanks for the suggestion, though.
–
RationalGeekJan 4 '11 at 15:18

IMHO Hudson is very limited in what it does correctly with VS projects. The checkouts are not tied to changesets the way you expect and behind the scenes it is doing nothing other than running a batch file you create through a web interface and a lot of plug-ins. The reporting it kind of nice if you can get it to work well though.
–
BillJan 4 '11 at 15:21