Build Automation System using Cruise Control .NET (CCNET)

In a Team development environment where parallel development and testing goes we find a requirement of getting most recent build to test as well as some specific build to give the QA to do testing on. This post describes what all are needed to set up an automated source code integration and build system for an environment where we use Visual Studio for development, Some source control (VSS, Vault Gear etc) for source depot.

Why do we need a continuous source code integration and build system? well, this helps the QA team by allowing then to not spend more time in syncing the source and doing a build everytime or even working on a relatively older build. This works as a perfect backup for your Source Control and also your deployment server build. This also allows to align the builds numbers to be same as your assembly\file version and also to the source control label there by making a particular build to be a complete unit in itself in terms of readiness for deployment or using the same for development.

Now coming back to build server where we can use cruise control .NET for source integration along with a couple of batch scripts to control the build number and assembly version. CCNET pings the source control (VSS or Vault etc) after every 30 mins (this is a default value and can be changed) to see if there are any modifications. If there are then it triggers a build and publishes it on the Build Server. Once done sleeps again for 30 mins unless it is Forced for a build in between i.e. you can manually force a build in between sleeps.

Let me explain the two components of build server in details below:

1) Cruise Control .NET:
Its an open source build and integration engine which can be downloaded freely from installation is done CCNET (CruiseControl.NET) needs to be configured according to your requirements. the config file can be found at “%SYSTEMDRIVE%\Program Files\CruiseControl.NET\Server\ccnet.config”.
A Sample configuration looks like below (using Sample Project and Source Gear Vault as source control provider):

2) Batch Scripts (Same Build and Assembly Version):
There are two batch scripts used to control the assembly version. For any executable or dll assembly version is generated based on AssemblyVersion attribute defined in AsseblyInfo.cs file. In order to have same Label and assembly version we can use batch script to change the attribute at runtime and then revert the same at the end of build process again during runtime.

Once the source integration is done by CCNET and is ready for build we change the file attributes of AssemblyInfo files (more in case of multi project solution) to -R so that AssemblyVersion attribute can be changed to build label thereby making the version of generated dll’s and exe’s with the same version. Now to revert back we use another script which changes the AssemblyVersion attribute back to and change the file attribute back to +R there by dodging the source control to not treat this as a modification otherwise it will consider this as a modification and trigger the build again and go to an infinite loop of build 🙂

For mutli project systems where you need many assemblyinfo files to be changed you can use some utilities like replace.exe
Below is an example of how a batch script would look like:
attrib /S -R AssemblyInfo.cs replace.exe -find “” -replace “%CCNetLabel%” -fname AssemblyInfo.cs

Complete reference on the configuration blocks can be found at One of the useful publisher which is missing in the above config is Email publisher where-in you can send mails for build success\failure to single\set of people. This help in tracking the build failures and also QA team notification in case of build succeeds.

This can very well be integrated with NUnit for executing test cases ones the build succeeds. This post doesnt cover this though more information on this can be found at CCNET link provided above.

There is a UI support too for CCNET to control the build trigger and view build results\logs. it can be found at http://[BuildServer]/ccnet . The web dashboard for ccnet looks like:

Hope this post will help in case you are planning to set up an automated build and integration system or you are looking for a solution to have same build and assembly version for you current systems builds.

bye for now.

Blog Directory - Blogged


11 Responses to Build Automation System using Cruise Control .NET (CCNET)

  1. K says:

    Hi good to see your post here, I was trying to implement the same in my project and was struggling for the way to do it. Can you help me in knowing how I can update the DLL version number with the CCnet Build number and create the EXE’s with the build number. your help in this will be great help

  2. sushantp says:

    Hi Kishore,

    Point 2) above explains how to get the version no. of your DLL same as CCNET build number. You would need to edit the AssembleInfo files on the build server by using a small batch script. CCNETLabel environment variable is your build number which you replace with version no like “” as given in your assemblyInfo file.

    Please let me know in case you have any further queries.


  3. Reslie says:


    Is Cruise Control .Net the same as the Team Foundation Build offered by Visual Studio?

  4. sushantp says:

    Hi Reslie,

    Yes TFB which comes as a part of TFS is same as Cruise Control .NET. You can configure TFB to do automation builds, Run unit test cases, Publish build and then generate build reports. TFS is an integrated solution for you project management, source version control, build server, bug management, project reporting and solution testing.


  5. Reslie says:

    Thanks for your reply!

    I am currently working on a Business Case Report regarding implementation of Cruise Control in a project here in our company. I hope you could provide inputs on the following queries:
    1. On an expert’s view, assuming a medium-scale project would employ Automated Build using Cruise Control, how much percent improvement will it bring against using Manual Build?
    2. Do you think the use of Cruise Control will also bring signigicant improvement in the Code Rework Effort? By how many percent (estimate)?
    3. What do you think are the constraints of using Cruise Control?

    I will hope for your response on these queries.

    Thanks again!

  6. sushantp says:

    Hi Reslie,

    Here are my comments for your queries:

    1) For devs no improvement, for QA it depends upon team size as if the QA team consists of 1 or 2 QA then you dont need to automate the build server and manual build will do. But for a team of say 3+ then having manual build will require get latest each time, different QA may not be in sync, no version of build would be there to test against. Hence it is more of process improvement using build server and results easily in 20-25% improvement in eventual QA process. Makes their life easy 🙂

    2) I am not able to get which code rework it is? If it is solution\project code rework then No Improvement. If it is build code rework then exactly same code works for multiple projects\solution as it just requires configuration changes.

    3) I would be able to answer properly if you ask specific area you are looking for constraints.
    About features – it has build, nunit plugin, publish, version control connection, email etc there are a lot which you can find on the home page of cruisecontrol.NET.
    – I was not able to use it to run any test case as I was not using NUnit and didn’t tried with other option though I think I can use VS from CCNET and do unit testing too.

    Hope this helps!!


  7. Ajay says:

    Hi Reslie,

    I think you should give a look at following article by Martin Fowler on Continous Integration to get detailed information on CI & CruiseControl.


  8. Visitacion says:

    If your site was very good. I wish you success. Oyun,Oyun Bilgini

  9. site build it…

    […]Build Automation System using Cruise Control .NET (CCNET) « Sushantp’s Weblog[…]…

  10. best free web host…

    […]Build Automation System using Cruise Control .NET (CCNET) « Sushantp’s Weblog[…]…

  11. juegodemotos says:

    I simply were going to do prevent and thank you for allowing me to
    run down.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Who am I what am I doing?

Who am I what am I doing?

%d bloggers like this: