Does it work?

CruiseControl.Net Tutorial – Part 2

1. Tasks Block
2. MsBuild Task
2.1. MSBuild and ReferencePath – CruiseControl.NET not resolving reference to Nunit
2.2. An Alternative MSBuild Logger – Christian Rodemeyer’s MsBuildToCCNet
2.3. CruiseControl.NET Webdashboard fails in finding images if not installed in virtual directory
2.4. MSBuildToCCNET reports wrong number of compiled projects
2.5. CruiseControl.NET, MsBuild Task and Resources – Assembly Linker
2.6. CruiseControl.NET, MsBuild Task and Web Application projects
3. Nunit Task
3.1. Nunit Task
3.2. Executable Task
4. Publishers Block
5. PreBuild Block
5.1. Install Nant
5.2. Nant Fundamentals

This article is the revised and updated version of an old one I wrote back in 2008.
This post is the second one of a series dedicated to CruiseControl.Net that I wrote back in 2008.
In the first part of this article (which you can find here) we installed it and had an overview of how to configure it.

Then we started to configure a project file: we instructed the Source Control Block to use Subversion, the Trigger Block to check it periodically and the Labeller Block to use: assemblyVersionLabeller
In this second article we will see the Tasks Block and I will point out some issues that might arise and provide solutions as well.

1. Tasks Block

The tasks block represents how the build of the project actually takes place.
In our example we will use an MsBuild Task to accomplish the main purpose of our project, which is to compile the versioned Visual Studio solution.
After that we will use an Executable Task to run our unit tests, if the build succeeds.
Let’s see the whole Tasks Block, first:

<!-- compiles working copy -- >
    <projectFile>DummySolution.sln</projectFile >
    <buildArgs>/noconsolelogger /v:quiet
      /p:ReferencePath="C:\Program Files\NUnit\bin"
    <targets>ReBuild</targets >
    <timeout>600</timeout >
    <logger>c:\Program Files\CruiseControl.NET\server\Rodemeyer.MsBuildToCCNet.dll</logger>
<!-- launches nunit tests on working copy -- >
    <executable>C:\Program Files\NUnit\bin\nunit-console.exe</executable>
      /nologo Dummy.sln.nunit


Let’s focus on the MsBuild Task first and see how we can configure and customize it:

→ top of post
→ top of paragraph

2. MsBuild Task

Let’s have a look at the meaning of the xml nodes children of the node: <msbuild>

<executable>: contains the path to the msbuild executable file. You don’t really need to set it because the default value is the standard installation path. This example dates back to .Net framework 2.0 so: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe.
I decided to set it explicitly just to be sure about it .
<workingDirectory>: is the directory in which MsBuild will be run, so it must be the directory containing our project’s checked out working copy. You can provide a path relative to the current project’s workinDirectory but I preferred to provide the full path. Actually, the path to the CCNET checked out working copy is the same as the field of the Source Control Block.
<projectFile>: is the name of the project to build. MsBuild accepts a Visual Studio solution file as the project file to build. Obviously the MsBuild Task accepts it as well.
<buildArgs>:This row provides additional command line arguments to MsBuild. We tell it not to log events to the console (/noconsolelogger), to build the Debug configuration (/p:Configuration=Debug) and to provide a reduced output (/v:quiet).
As far as the /p:ReferencePath buildArg is concerned it is worth to talk extensively about a problem that could arise with Nunit, so have a look at paragraph 10.1.

2.1 MSBuild and ReferencePath – CruiseControl.NET not resolving reference to Nunit

It could happen that CCNET is not able to locate Nunit (or some other dependency assembly) depending on how your project file has been created by Visual Studio.
Open your project file (DummyProject.csproj) with a text editor (e.g.: Notepad++). If you find an entry as follows in it:

  <Reference Include="nunit.framework, Version=,     Culture=neutral, PublicKeyToken=96d09a1eb7f44a77,     processorArchitecture=MSIL" />


with no path associated to the Nunit it could be that CCNET will not be able to resolve that reference if you don’t register nunit.framework.dll in the server’s GAC.

You can make sure that CCNET is able to resolve the dependency by providing an alternative search path in which to look for.
Each assembly referenced in the Visual Studio project file needs to be located by MSBUild at compile time.
The location of the referenced assemblies is resolved by MSBuild by looking in several locations in a particular search order (as explained here).
We could modify the .csproj file by providing a value as a child node of the node, e.g.:

<Reference Include="DummyLibrary, Version=,     Culture=neutral, processorArchitecture=MSIL">


This approach has two drawbacks:

  1. the hintpath is a relative path, thus making the build success depend on the location of the project relative to the referenced assembly (this could be a problem if we reference an external assembly);
  2. we need to modify each Visual Studio project file by hand and we don’t want to do it!

Fortunately there’s an easy way out:
we can override all the project specific settings for path resolving by passing a ReferencePath property from the MSBuild command line.
Such property accepts as value a list of paths (MSBuild DummySolution.sln /p:”ReferencePath=<Path1;Path2;Path3>”) and it is checked by the build process before checking other locations (HintPath for example).
So the way to provide an alternative search path from the command line is to pass as argument a ReferencePath property.
This is the reason why the command line provided in the field contains the ReferencePath property pointing to the Nunit install path:
/p:ReferencePath=”C:\Program Files\NUnit\bin”.

→ top of post
→ top of paragraph

end of paragraph 2.1
continues paragraph 2. MsBuild Task

Let’s go on with the analysis of the xml nodes children of the node:<msbuild>

<targets>: specifies which targets to build in this msbuild project file. It represents the MSbuild’s /target command line argument. We set it to Rebuild (clean and build).
<timeout> : is the number of seconds before assuming that the process has hung. If timeout is exceeded the process will be killed.
<logger>: specifies the path to the assembly containing the logger to use to format the log output of MSbuild .

As of today I see the website down and the old thoughtworks url to download the default xml logger is not available. So the following excerpt from my original post is no more valid:


To use the default logger:

  • leave out the field,
  • download the assembly containing the default xml logger here (find info here),
  • copy the downloaded assembly (ThoughtWorks.CruiseControl.MSBuild.dll) to the folder: C:\%ProgramFiles%\CruiseControl.NET\server.


The only alternative is to use the logger that I used in the configuration shown above, described in the following paragraph 2.2.

I suggest to use the alternative logger (by Christian Rodemeyer) as explained in the following paragraph. The RodeMeyer’s logger provide lighter msbuild output and his modified stylesheets provide much more readable display of such information.

10.2. An Alternative MSBuild Logger – Christian Rodemeyer’s MsBuildToCCNet

I chose to use a logger alternative to the default one: Christian Rodemeyer’s MsBuildToCCNet.
You can find it at: Improved MSBuild Integration.  The original website is not available but someone uploaded to GitHub.

The lost project page cited above provided detailed instructions on how the logger works and how it should be configured.

Unfortunately such information is lost.
In the current paragraph I’ll try to illustrate the installation process and add some useful tips for making it work.
You can download the original release by the author: Rodemeyer.MsBuildToCCnet.dll (download here).

Just copy the assembly to the \CruiseControl.NET\server folder (e.g.: c:\Program Files\CruiseControl.NET\server\).
There’s another subdirectory of the MsBuildToCCNet Github project, named ccnet where you can find the resources needed to correctly display the logs produced by Rodemeyer’s logger. Those resources are:
cruisecontrol.css and

You need to use those two files and configure the Webdshboard:

  1. Move into your CruiseControl.NET Webdashboard folder, under the path: C:\%ProgramFiles%\CruiseControl.NET\webdashboard (e.g.: c:\Program Files\CruiseControl.NET\webdashboard\) and back up the file: cruisecontrol.css.
    Then replace it with the cruisecontrol.css file you found in the Rodemeyer’s MsBuildToCCNet folder (e.g.: copy MsBuildToCCNet\ccnet\cruisecontrol.css to c:\Program Files\CruiseControl.NET\webdashboard\cruisecontrol.css);
  2. There’s a subdirectory of the CruiseControl.NET Webdashboard folder, named: xsl.
    You need to copy the other resource (msbuild2ccnet.xsl) you found in the MsBuildToCCNet\ccnet folder in that directory: C:\%ProgramFiles%\CruiseControl.NET\webdashboard\xsl\;
  3. You need to modify the dashboard.config file in the CruiseControl.NET Webdashboard folder in order to correctly show the output of the logger.

Being that we’re talking about the Webdashboard configuration I will show you all the changes you will need to do to let it work with the following three components (even if we’ll see two of them only in the following paragraphs):

  • MsBuildToCCNet
  • Nunit integration
  • FxCop integration

First of all choose a 32 x 32 jpg image representing a smiling icon and place it in the CruiseControl.NET Webdashboard folder: C:\%ProgramFiles%\CruiseControl.NET\webdashboard.
Rename the image file: your_happy_image.jpg and, when a new build succeeds, you’ll obtain a smiling icon in the Webdashboard report! (you can find a sample image here).
Then open CruiseControl.NET\webdashboard\xsl\msbuild2ccnet.xsl and go to line 24:

<xsl :if test="@error_count = 0 and @warning_count = 0">
<td><img src="/ccnet/your_happy_image.jpg"
           alt="Happy Image :-)" /> Juchuu !!!</td>

replace the img src attribute: /ccnet/your_happy_image.jpg with /your_happy_image.jpg if you configured iis with a new website for the webdashboard instead of a virtual directory. If you’re usign the default virtual directory named ccnet, don’t modify that row.
Next you need to locate the field: in C:\%ProgramFiles%\CruiseControl.NET\webdashboard\dashboard.config and arrange or delete its children nodes in order to obtain the following configuration (remember to back up the file first):

  <buildlogbuildplugin />
  <xslreportbuildplugin description="NUnit Details"
       xslFileName="xsl\tests.xsl" />
  <xslreportbuildplugin description="NUnit Timings"
       xslFileName="xsl\timing.xsl" />
   <xslreportbuildplugin description="FxCop Report"
       xslFileName="xsl\FxCopReport.xsl" />

As you can see, such configuration includes also stylesheet files for nunit and fxcop integration. We will soon configure the server to integrate those components.

→ top of post
→ top of paragraph

end of paragraph 2.2
continues paragraph 2. MsBuild Task

While adding the smiling image in the previous paragraph we had to change the path in the xsl file.
The same problem could arise with other stylesheet files if you configured the webdashboard to be a website instead that a virtual directory named ccnet.
Have a look at the next paragraph for details:

2.3. CruiseControl.NET Webdashboard Fails in Finding Images if Not Installed in Virtual Directory

If you unchecked ‘Create virtual directory in IIS for Web dashboard’ as shown in part 1 of this tutorial at 3.1. Install CruiseControl.NET and installed the Webdashboard as a new website as shown in the paragraph: 3.2. Create a CCNet Website in IIS, the webdashboard could have problems in resolving image paths.
You will realize it as soon as you will configure the server to integrate nunit or fxcop (will see it in following paragraphs).
To make sure not to have this problems you must modify the following files:
under: C:\%ProgramFiles%\CruiseControl.NET\webdashboard\.

You have to replace all the paths relative to the root of the website with relative paths, e.g:

in the file: xsl\tests.xsl you should replace all entries like:

eImg.src = "<xsl :value-of select="$applicationPath"/>/images/arrow_minus_small.gif";


eImg.src = "<xsl :value-of select="$applicationPath"/>images/arrow_minus_small.gif";


and entries like:

<img src="{$applicationPath}/images/fxcop-error.gif"/>


<img src="{$applicationPath}images/fxcop-error.gif"/>

that is, you simply need to delete the leading ‘forward slash’ at the beginning of the path (just before the ‘images’ folder name).

you need to accomplish the same task with the file xsl\fxcop-summary.xsl, that is you should replace entries like:

<xsl :attribute name="src"><xsl :value-of select="$applicationPath" />/images/fxcop-critical-error.gif</xsl>


<xsl :attribute name="src"><xsl :value-of select="$applicationPath" />images/fxcop-critical-error.gif</xsl>

Actually, you should find all paths to images in those two files and delete the leading forward slash.

→ top of post
→ top of paragraph

end of paragraph 10.3
continues paragraph 10. MsBuild Task

Back to the MSBuildToCCNET alternative Logger for MsBuild, I will explain now why I decided to recompile the source code instead of using the assembly provided: MsBuildToCCNet\Release\Rodemeyer.MsBuildToCCnet.dll

2.4. MSBuildToCCNET Reports Wrong Number of Compiled Projects

I found that MsBuildToCCNet reported the wrong number of projects in the webdashboard in the page reporting the details of the last build.
There’s a row that sounds like the following, displaied in that page:
’15 Projects built with 2 warnings’

Looking at the source code (in the file: Logger.cs) I realized that the list of Project type instances includes the solution file (DummySolution.sln) and a Project object named “MSBuild“, somehow representing the MsBuild process.
Appearently this is the reason why the reported number of projects is wrong.
I still haven’t tried to contact the author so I don’t know very well how the Logger is supposed to work as far as this count is concerned.
As a workaround I modified the following row:

w.WriteAttributeString("project_count", XmlConvert.ToString(projects.Count));

turning it into:

w.WriteAttributeString("project_count", XmlConvert.ToString(projects.Count - 2));

in the ‘WriteLog(XmlWriter w)’ method (file: Logger.cs at row 104).

This seems having fixed the problem with no side effects.

→ top of post
→ top of paragraph

end of paragraph 2.4
continues paragraph 2. MsBuild Task

You could have problems running msbuild task if your server machine (the one in which you installed CruiseControl.NET) is not updated with all the software installed in a developer workstation. Let’s see which problems could arise:

2.5. CruiseControl.NET, MsBuild Task and Resources – Assembly Linker

If you want to provide localization for any of your projects or somehow use resources files (.resx) you will get an error during the build on the CruiseControl.NET server if MsBuild is not able to locate the Assembly Linker.
The error should look something like (remember that this post originally was posted at the time of .Net framework 2.0):

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(1950,9): error MSB3011: “C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\AL.exe” was not found. Either 1) Install the .NET Framework SDK, which will install AL.exe. Or 2) Pass the correct location of AL.exe into the “ToolPath” parameter of the AL task.

AL.exe is used to produce the satellite assemblies and the executable file is placed in the .NET framework directory.
But Al.exe is a .Net Framework SDK tool. It is not included in .Net Framework 2.0 runtime installation.
You need to install the .NET framework SDK on the server machine if you don’t want to encounter this problem.
If you want to solve this particular issue in a tricky way without installing the whole SDK, you can copy al.exe.config e al.exe from a developer workstation and place them in the C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 directory on the server machine.
This is how I solved the problem but I suggest you to install the .NET framework SDK on the server machine.

→ top of post
→ top of paragraph

2.6. CruiseControl.NET, MsBuild Task and Web Application projects

A particular note is due for Web projects.
Updating Visual Studio 2005 you get the SP1. Together with the Service Pack 1 for Visual Studio you get the WebApplication project template.
Such template lets us add a new kind of project to our solution: a web site project structured exactly like any other Visual Studio project.
So you can quit creating new websites (File –> New –> Web Site…) and start creating new WebApplication projects (File –> New –> Project… and then choose ‘ASP.NET Web Application‘).

In order to use WebApplication projects you need to have Visual Studio installed on your machine and the WebApplication project plugin (that comes with the Visual Studio 2005 SP1).
If the server in which CruiseControl.NET server is running is not a develpment workstation you will get an error when trying to build a WebApplication project, beacuse you miss those two prerequisites.

You can easily fix this problem: you simply need to copy the file: Microsoft.WebApplication.targets that you can find under:
“C:\Program Files\MSBuild\Microsoft\VisualStudio\v8.0\WebApplications\”
from a development workstation and paste it to the corresponding path on the server machine (creating the directories in the path if needed).

Additionally, if you’re using an ASP.NET AJAX Enabled WebApplication as the web project template you need to install the aspnet-ajax extensions as well.
You can find the installer (ASPAJAXExtSetup.msi) for .NET framework 2.0 here

→ top of post
→ top of paragraph

3. Nunit Task

The second Task Block that you find in the xml fragment above is an Executable Task used to instruct CruiseControl.NET to run unit tests with Nunit.

At first I tried to use a Nunit Task Block but I soon realized that it was not good for me because it was not possible to provide arguments to the task that should be used as arguments of the Nunit command-line executable.

This is a problem because there’s no way to let the Nunit task be aware of Nunit categories.
For those who don’t know, Nunit lets you specify a ‘Category‘ attribute in test methods, with the following syntax:

public void VeryLongTest()
{ /* ... */ }

This attribute allows you to instruct Nunit to treat all the methods belonging to the same category in the same way.
Usually what we want to do is to exclude a cluster of tests from running.
Typically we exclude tests that take too much to run, using the following syntax with the nunit command-line tool:

nunit-console.exe /exclude:LongRunning,AnotherCategoryName

You can configure excluded categories in nunit GUI as well, by clicking the ‘Categories‘ tab in the top left corner.
A list of available categories will be shown. Just select the categories of interest and click the Add button.
Then check the Exclude these categories checkbox at the bottom of the page and run the nunit project.

It is very useful to be able to exclude some categories of tests from the continuous integration environment, still being able to run them on developer machines.

This is the reason why, back in 2008, I submitted a patch to CruiseControl.Net adding support for Nunit categories.
The patch is included starting from build: 3591.
So now you have two chances to use categories:

  1. If you really want to use the last officially released version, read the paragraph 3.2 about how to use an Executable Task (the method described can be useful also if you want to use any other unsupported Nunit command line argument);
  2. use the Nunit Task block, as explained in paragraph 3.1

3.1. Nunit Task

It is possible to specify a list of the categories of tests that we want to be excluded.
It is possible, as well, to specify a list of the only categories that we want to be included as allowed by the Nunit Command-line or GUI interface.
The configuration syntax for the Nunit task becomes:

<path>C:\Program Files\NUnit 2.4.7\bin\nunit-console.exe
  <excludedCategory>Category 2</excludedCategory>

for excluded categories, or:

<path>C:\Program Files\NUnit 2.4.7\bin\nunit-console.exe
  <includedCategory>Category 2</includedCategory>

for included categories. At the moment the official documentation is not available since the website: is down.

The Nunit task output log file is automatically integrated in the CCNET build results.
So you don’t need to specify the Merge task (needed if you use the procedure explained in paragraph 3.2 instead of this one) in the Publishers block as explained in paragraph 4:


Instead you still need to delete the previous Nunit log file before each build process as explained in the paragraph 5 – PreBuild Block.

→ top of post
→ top of paragraph

3.2. Executable Task

If you want to replace the Nunit Task with an Executable Task you can try the one shown below:

    C:\Program Files\NUnit 2.4.7\bin\nunit-console.exe
    /nologo Dummy.sln.nunit

You only need to specify the full path to the Nunit command-line executable file in the field and the command-line arguments in the field.

In the field you specify arguments as if provided directly to nunit-console.exe:

  1. specify the path to the file in which nunit will write its output: /xml:..\project1CCnetArtifacts\nunit-results.xml.
    The file should be produced in the artifactDirectory of the current CCNET project.
    By default the executable run by an executable task is run in the Project Working Directory, so the path to the output file is relative to such directory.
  2. You can pass many things as Nunit targets (assemblies, Visual Studio projects or Nunit project files). I suggest to create an Nunit project and pass it as argument to nunit-console.exe as shown in the sample above (where the nunit project file is called: Dummy.sln.nunit).
  3. you can then add: /exclude:LongRunning,AnotherCategoryName thus excluding unwanted tests.

Specifying the name of the output file is not enough.
In order to make the output written by nunit in the file nunit-results.xml (arbitrary name specified in the buildArgs tag), available to CruiseControl.NET we need to use a File Merge Task.
If we used Nunit task the output file would have been automatically merged with other output for CruiseControl.NET.
Using the Executable Task we need to explicitly configure CruiseControl.NET to merge the Nunit output file in the log file parsed by CruiseControl.NET.
We will tell CruiseControl.NET to do it at the end of the build process, namely in the Publishers section.

→ top of post
→ top of paragraph

4. Publishers Block

We will add a File Merge Task at the beginning of the Publishers section. You can see below the publishers section as it is defined in our project configuration file:

  <xmllogger />
  <statistics />
  <modificationHistory onlyLogWhenChangesFound="true" />
  <artifactcleanup cleanUpMethod="KeepLastXBuilds"
    cleanUpValue="20" />

The File Merge Task specifies the paths to the files that we want to be merged by the Xml Log Publisher Task with the rest of its own output (you don’t need to specify nunit output file if you used the Nunit Task as in paragraph 11.1. Nunit Task).
All of this output is placed by default in the buildlogs directory under the Project’s Artifact Directory.
So the File Merge Task should appear before the Xml Log Publisher Task in the publishers section.
The Xml Log Publisher Task (‘xmllogger‘) is needed for making the web dashboard work correctly.
The ‘statistics‘ field collects and updates statistics for each build. You can see them clicking: View Statistics on the left side of the Web Dashboard.
The ‘modificationHistory‘ field logs all the modifications for each build. With onlyLogWhenChangesFound you can choose to log info only for builds happened when changes take place (not for forced builds). You can see the modification history by clicking: View Modification History on the left side of the Web Dashboard.

I then added an ‘artifactcleanup‘ field in order to keep memory of the last 20 builds only.
This task allows us to choose between two clean up modes of the past build logs:
– deleting logs older than a specified number of days
– keeping only a specified number of logs: the more recent ones (cleanUpMethod=”KeepLastXBuilds”)

In the sample above we typed the second choice specifying 20 as cleanUpValue thus telling CruiseControl.NET to keep the log files for the last 20 builds only.

→ top of post
→ top of paragraph

5. PreBuild Block

There’s another issue to solve when integrating Nunit using either an Exec Task or the Nunit Task: the Nunit log file is not deleted after the build succeeds or fails.
So upon the next build we’ll still have the old Nunit log file until the Task running Nunit is executed.
To understand what I’m going to explain now, keep in mind that if a task in the Tasks Block fails all the subsequent tasks in the block will be skipped while the tasks in the Publishers Block will be executed.

If, during the next build, the MSBuild Task fails, the Exec Task (Nunit Task) launching Nunit isn’t executed at all so the File Merge Task will merge the previous Nunit log file with the current Xml Log Publisher output, thus leading to an incorrect report: still displaying the Nunit results relative to the previous build.
We would obtain the current MSBuild report but the old Nunit report.
This behavior can lead to misunderstanding of the results so it is a good practice to delete the old Nunit log file before every new build takes place.

The place to accomplish this task is the PreBuild Block.

The following part contain reference to tool versions not up to date. They were the latest release at the time the article was written. Make sure to have the latest version if you want to try.
I used a Nant build file to drive the steps needed to obtain the desired result (simply delete a file if it exists).

5.1. Install Nant

You need to install the Nant Build tool on the server machine.
Just download the zip package: from here and unzip it into the folder: C:\Program Files\Nant.

5.2. Nant Fundamentals

Nant is a build tool driven by xml configuration files (Nant build files).
When you call nant.exe from the command line and you don’t specify a build file (you can specify one passing as argument: -buildfile:pathToDir\ NAnt looks for a file ending with .build (e.g.: in the current directory. If it finds such file, it uses it as the reference for the tasks to execute.

The file structure is shown in the following sample xml file:

< ?xml version="1.0"?>
<project name="dummy" default="target1" basedir=".">
  <description>dummy project</description>
  <target name="target1" description="target1 description">
      ... (a list of Nant tasks will be placed here)
  <target name="target2" description="target2 description">
    <delete file="pathToFile\FileName"
                failonerror="false" />
    ... (a list of other Nant tasks will be placed here)


A build file contains one field with one or more children fields each containing different Nant tasks (e.g.: the task).
When invoking nant.exe you can specify the name of the target to be executed and Nant will execute all the tasks contained in that target. If you don’t provide a target, the default one will be executed (i.e. the one specified in the ‘default‘ attribute of the field).

end of paragraph 5.2
continues paragraph 5. PreBuild Block

Once you’ve got Nant installed on the server machine you have to create a file named and place it, for convenience, in the directory in which you placed all the CruiseControl.NET related stuff (in this example: C:\develop\CCnet).

At the moment we need just one target to delete Nunit log files. Later we will add another target.
The actual file content is the following:

< ?xml version="1.0"?>
<project name="Dummy" default="cleanNunit" basedir=".">
  <description>CCNET Tasks</description>
  <target name="cleanNunit"
         description="removes nunit log file">
    <delete file="${CCNetArtifactDirectory}\nunit-results.xml"
          failonerror="false" />

When we tell Nant to execute the ‘cleanNunit‘ target, the delete task will be executed and the nunit-results.xml file will be deleted.
We use one of the environment variables provided by CCNET to retrieve the path to the artifact directory: ${CCNetArtifactDirectory} so this Nant build file will only work when run from CruiseControl.NET.

In the Prebuild Block we will instruct CruiseControl.NET to run a Nant task by adding a CruiseControl.NET Nant Task Block.
Such block lets us instruct CruiseControl.NET to execute Nant and lets us specify a Nant build file and the list of Nant targets to execute.
Remember that we named the build file: and we placed it in the directory: C:\develop\CCnet.
Now we provide this information to the CruiseControl.NET Nant Task Block as shown in the following example:

<!-- clean nunit output to avoid CCNET reporting
       about previous build tests if current build fails -->
    <executable>C:\Program Filse\Nant\bin\nant.exe

the field specifies the path to the version of nant.exe you want to run,
the specifies the directory to run the NAnt process in,
passes the -nologo argument to the Nant command line,
specifies the path to the build file to use (relative to the ),
is used to specify a list of targets, each one in a field.

Now we can be sure that each build has the Nunit log file deleted before being executed.

→ top of post
→ top of paragraph

Leave a Reply

%d bloggers like this: