top of page

Using NAnt with CCNet

This is the fourth article of the series. In the last article we had seen the usage of MSBuild. In this article we will look at the NAnt. NAnt is free and open source software for automating the build scripts, its a very powerful tool. It is just like Apache Ant but it is designed for .net. Its name comes from the fact that it is "Not Ant". There are several tools for creating NAnt script. But we will use NAnt builder. Now we will shift the all our tasks in the NAnt script. NAnt file have an extension of .build. I will now discuss in writing NAnt script. For this we will extend our previous example and will write the script for our example. Here is how the NAnt script looks like.

<?xml version="1.0" encoding="utf-8"?>
<project name="Trade Simulator">
   <target name="build.Project">
     <exec program="C:WindowsMicrosoft.NETFrameworkv4.0.30319MSBuild.exe">
       <arg value="D:ReposcruisecontrolAurora_UIAurora_UI.sln" />
       <arg value="/t:Rebuild" />
       <arg value="/p:Configuration=Release" />

The NAnt script is just an xml file which starts with project tag. We have define the project name Trade Simulator. Than there are targets in the project, a target is just a task. There can be multiple targets in the project or just one. As per now we have only one, but as we move on we will add other targets. So for now our aim is to build our visual studio solution file using NAnt script.

We have a target name build.Project which will build our visual studio solution file. This will simply call msbuild using exec property, exec property can execute any exe file. So we will execute MSBuild and pass the arguments the solution file path and the building parameters.

Now the next task is using this NAnt script in our cruise control configuration file so that it can build our project. For this we have to modify our task tag in the ccnet config file.

  <executable>C:Program Files (x86)NAntBuilder 2nantbinNAnt.exe</executable>
  <baseDirectory>D:ReposcruisecontrolAurora_UIccnet config file</baseDirectory>


I have placed the file in the ccnet config file directory. Here what i have done is just calling an executable NAnt.exe and give the build script path in the base directory and name of the file in the buildFile property, The logger is necessary as it will log the NAnt results. You can set the time out so if the NAnt script get stuck somewhere it will time out its session control will be taken from it.

Up till now you have just used the NAnt script. As we always discuss that feedback is the most important part of the CI process. NAnt has its plugin which comes with cruise control, you just need to install in the web dashboard, Than you can see that how powerful is the NAnt tool.

Now you need to install the NAnt plugin in the web dashboard, it can be done easily in the following number of steps.

1. Open web dashboard of CCNet.

2. Go to Administer Dashboard from the menu.

3. Enter the password

4. You will see the following screen.


5. Click on the NAnt results you will see the following screen.


6. Click on Install to install the plugin, that was all you need to do. Just restart your IIS so that the settings take effect.

Now lets see the results of our NAnt script.


On Clicking on the NAnt Timings we see the NAnt Build Timing report. Since we have only one target so the section is empty, when in next articles we have more than one targets, than it will show all the targets and the time taken by them.

So this was all about NAnt. In the next article we will use Nunit and automate the results of test cases. So in this way we are moving further in automating our own CI process.

Previous articles link:


bottom of page