top of page

Getting Started With CruiseControl.NET

This is the second article of the series. In the last article we had discussed about the Continuous Integration (CI) and its advantages, now lets move toward setting the CI using some tools. There are many tools available for configuring CI. CI is not possible without any source control system. There are many CI servers for .net environment but we will undergo with

Its an open source system and is easily available. You can download the latest version of ccnet from here.

Installing ccnet:

Run the setup installation file you will see an installation wizard click next then accept license agreement and click next you will see the following screen

If you have installed IIS on the same machine then you can install web dashboard it is strongly recommended that you should install web dashboard. As in CI most important part is feedback that is you always wanted to know that what happened with build? Was it succeeded or failed? What happened with the test cases? How many of them were succeeded and and how many were failed?. You can get all this information in a Web dashboard.

You can configure to run ccnet as your window service in this screen, if you have installed IIS on your machine by second option it will configure everything you need. While installing Web Dashboard if you get a message to select version choose at least 2.0.

Configuring ccnet:

After the installation completes then only thing you need is to configure ccnet and all things will work. To access configuration file go to the installation directory or by default %Program Files%CruiseControl.NETserverccnet.config. You can open ccnet.config file in notepad and edit it. Its an xml based configuration file. By default it looks like the following

<cruisecontrol xmlns:cb="urn:ccnet.config.builder">
<!-- This is your CruiseControl.NET Server Configuration file. Add your projects below! -->
<project name="MyFirstProject"
description="demoproject showing a small config">
<!-- check the source control every X time for changes,and run the tasks if changes are found -->

<sourcecontrol type="nullSourceControl" alwaysModified="true"></sourcecontrol>
<!-- if you want the task to fail, ping an unknown server -->
<description>Pinging a server</description>
<xmllogger />
<artifactcleanup cleanUpMethod="KeepLastXBuilds" cleanUpValue="50" />

Its the default configuration we have to change it according to our scenario. We will use some trading application(.net code) as our example. Firstly you need to have the basic things in configuration file. Lets discuss one by one and their configuration also.

Project Tag:

ccnet can have multiple projects running at the same time, but we will use only project. We will do step by step configuration.

 <project name="MarketDataSimulator">

In this we have configured our project name you can change it as you desire. The working directory is set to where the application code is placed. The artifacts directory is for ccnet build logs.

Next step is you need to add trigger.


Triggers are important in your CI project that is when your project should build. You can configure it weekly, daily, monthly, or many times per day. We will configure it on daily basis if the modifications occurs in code.

 <project name="MarketDataSimulator">
   <scheduleTrigger time="00:00:00" buildCondition="IfModificationExists" name="DailyBuild" />

In the triggers element we have the time of build and also provided buildCondition, i have set it to IfModificationsExisits, which means that if there is a change in the source code then we have to run the build on the time provided. The question is how it knows that the change has occurred in code. It is described in the next section.

SourceControl Tag:

This code section is responsible for getting the code from repository. The repository tells us the code has changed or not if its changed it will pull the latest code. We will use git to get the code here are the settings for it.

<sourcecontrol type="git">
 <executable>C:Program Files (x86)Gitcmdgit.exe</executable>

There are many properties in source control tag you can use them to configure it according to your scenario.


Publishers are important in CCNet because they provide feedback mechanism, although you can get feedback from the web dashboard but if you have more project members, stakeholders or team leads, they will not come to web to see what is going on. The publisher sends email to the members after the project build with the result of build. So they will get email and will be updated about the status instead of visiting the web dashboard on specific time as no one remembers that he has to visit web to check status. So this automated publisher will keep them informed.

Here is how you can configure the email publisher i have configured it for gmail server.

 <xmllogger />
 <email mailport="587" includeDetails="TRUE" mailhostUsername="" mailhostPassword="password" useSSL="True">
   <user name="user1" group="buildmaster" address="" />
   <user name="user2" group="buildmaster" address="" />
   <user name="user3" group="buildmaster" address="" />
   <user name="user4" group="buildmaster" address="" />
   <user name="user5" group="buildmaster" address="" />

   <group name="buildmaster">
   <subject buildResult="StillBroken" value="Build is still broken for {CCNetProject}" />




There are many things you need to configure for an email publisher, first you need the email server settings which varies from server to server, secondly you can make groups. Groups can be used to send a build failed results to specific group and build success to specific group and Always group receives all types of results. The next is xsl files, these are used to include the results of build in email e.g compile-msbuild will include errors in the .net project occurred during compiling the code. Remaining xsl files will be explained in next articles. Make sure you add xmlloger before email publisher it will help email publisher in generating results, if you dont add it or add it after email publisher you will see no results in the mail or even in xml logs.

Tasks Tag:

Its the main tag of ccnet where we include the tasks we need to perform such as compiling .net code or any other thing will be included in this. It has many extensions and usages. We will discuss major extensions in the next articles.

You can view the full project and its ccnet configuration file here. You can place the ccnet config file in the installation directory of ccnet and than run the ccnet it will get the code it self from the repository.

Previous articles link:


bottom of page