index-1-1.jpg
  • Aurora Solutions

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" />
     </exec>
    </target>
</project>

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.

<tasks>
<nant>
  <executable>C:Program Files (x86)NAntBuilder 2nantbinNAnt.exe</executable>
  <baseDirectory>D:ReposcruisecontrolAurora_UIccnet config file</baseDirectory>
   <nologo>true</nologo>
   <buildFile>Aurora.build</buildFile>
   <logger>NAnt.Core.XmlLogger</logger>
   <buildTimeoutSeconds>1200</buildTimeoutSeconds>
</nant>

</tasks>

I have placed the Aurora.build 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.

image

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

image

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.

image

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:

3. Using MSBuild with CCNET

2. Getting started with Cruise Contrl .NET

1. Introduction to Continuous Integration

Download Project

Recent Posts

See All

Automating WIX Installer using CCNET

This is the last article of the series Continuous Integration in .NET using Cruise Control.net. In the last article we had discussed that how we can use NUnit with ccnet to run our test cases. In this

Using NUnit with CCNet

This is the fifth article of the series of Continuous Integration in .net using Cruise Control .net. In the last article we had covered the usage of NAnt with ccnet, in this article we move ahead and

Using MSBuild with CCNet

This is the third article of the series of Continuous Integration in .net, in the previous article, I had explained the continuous integration CI and setting up the cruise control .net. In this articl