MSBuild with Cruise Control .NET

You want to set up a customizable, fully automated build process.  You want your build process to incorporate FxCop, NUnit, NCover, etc. but you do not have the license for Team System.  No problem.  You can do all of this with free tools leveraging MSBuild and Cruise Control .NET (CCNet) as the basis of your solution.  This is not new news.  In fact, CCNet is probably the best known tool today to do automated builds.  However, there are lots of different ways to implement your build process.  I'm going to do a series of posts that provide a start to finish implementation of one way to set up your build server.  The posts will eventually include custom MSBuild tasks, custom CCNet add-ins, 32 bit / 64 bit considerations, and building MSI files with MSBuild.  In this post, I will just start with the primary structure and build process.

To kick off the MSBuild process, you'll use the standard "msbuild" task provided by CCNet pointing to the custom MSBuild project file that we'll construct "ccnetMSBuild.proj":

<projectFile>C:\Program Files\CruiseControl.NET\MSBuildScript\ccnetMSBuild.proj</projectFile>
<logger>ThoughtWorks.CruiseControl.MsBuild.XmlLogger,C:\Program Files\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll</logger>

 The basic outline of the msbuild script will be this:

  1. Version assemblies in the current solution (details to come in a later post)
  2. Do a Debug build (if compile fails, stop build)
  3. Run FxCop on the solution
  4. Run NUnit on the solution
  5. Run NCover on the solution
  6. If everything has run successfully, do a Release build

First, we utilize the standard msbuild task to do a Debug build.  Why do a Debug build before a Release build?  There are a couple of reasons.  First, Debug is the default mode for the developer on their local systems.  We encourage the developers to run FxCop locally before checking in - it's most convenient for them to be able to do this straight from Debug mode without having to first rebuild in Release mode.  Additionally, we typically will set our NUnit projects to build only in Debug mode but not in Release mode because we do not want to deploy NUnit projects out to a production environment.  Again, keeping it in Debug mode simplifies everything here.

This is the standard structure - in the interests of keeping this post a reasonable length, I will expand on the details on my next post...

posted on Friday, February 23, 2007 7:17 PM Print
# re: MSBuild with Cruise Control .NET
Ashok boddeda
9/3/2007 3:58 AM
Certainly, we need more info to get familiar with mentioned tools. However good article to read out.

# re: MSBuild with Cruise Control .NET
10/22/2007 1:10 PM
Steve, you have at the very end of this blog " I will expand on the details on my next post..." Did you ever create this series? If so can you please send me the links?

# re: MSBuild with Cruise Control .NET
Harish Kumar
3/14/2008 2:07 AM
Steve, Will this create a new MSI with the new label (CCNET Label) evry time build succeeds?
Also I havent got any project file with ccnet1.3.1 (C:\Program Files\CruiseControl.NET\MSBuildScript\ccnetMSBuild.proj). Please help me. I wanna make a new MSI according the label change......

# re: MSBuild with Cruise Control .NET
Nabeel Khan
7/15/2008 12:31 PM
Where is the next part.
# re: MSBuild with Cruise Control .NET
Ajit Dusane
5/18/2009 3:18 AM

could you please mail me all the stuff that you have related to cruise control .net ???

Thanking you in anticipation.

Ajit D
# re: MSBuild with Cruise Control .NET
5/18/2009 8:33 AM
@Ajit - This was one of a few posts a did on MSBuild a while back that I never got around to "fully" completing. Here is a link to some other topics: Additionally, if you have questions on any *specific* areas I can try to help. Thanks.
# re: MSBuild with Cruise Control .NET
Eric Ren
4/1/2011 1:35 AM
Hi this artical is helpful for me to first set up the build server, would you be kind please to send me other materials to help me set up my own build server, I am really new about this, Thanks

Post Comment

Title *
Name *
Comment *  

View Steve Michelotti's profile on LinkedIn

profile for Steve Michelotti at Stack Overflow, Q&A for professional and enthusiast programmers

Google My Blog

Tag Cloud