CruiseControl.Net – Installing and configuring with CVS, MSBuild and MSTest


CruiseControl.NET is an Automated Continuous Integration server, implemented using the Microsoft .NET Framework. It can be downloaded from:

CruiseControl.NET (CCnet) has three main components. The core is the Server, which automates the integration process. The Web Dashboard, which is a .Net web app which shows status and a detailed view of the projects. The third component is a system tray app which shows at a glance the state of the projects.


These should all be installed prior to CCNET:

  • IIS
  • .NET Framework
  • Visual Studio


CCNet comes with an installer, so installation is simple. Run setup.exe, and click next a few times. CCNet is installed into \Program Files (x86)\CruiseControl.NET\.

Note: At this point, I would give access to the NETWORK SERVICE, and possibly Machine\Users to the \Program Files (x86)\CruiseControl.NET\WebDashboard\packages directory and C:\Program Files (x86)\CruiseControl.NET\server directory. Otherwise, you may have trouble with updating config files, and the builds themselves updating some project files.


I am going to go through my configuration which uses CVS, MSBuild and MSTest.

Create the project

Edit the CCNET.config file found in into \Program Files (x86)\CruiseControl.NET\.

<cruisecontrol xmlns:cb=”urn:ccnet.config.builder”>
<!– This is your CruiseControl.NET Server Configuration file. Add your projects below! –>
<project name=”SilverCodeExchange”>


Next, we are going to add the configuration for CVS. This goes inside <project>…</project>. We point the executable to the SlickSVN version of svn.exe to do the actual Subversion work.

We assign the trunk URL to your CVS repository. Username and password are for your CVS repository. The working directory specifies local workspace.

<sourcecontrol type=”svn”>
<executable>C:\Program Files\SlikSvn\bin\svn.exe</executable>

Trigger the Build

Now, we add a trigger to tell it when to do the build.

<intervalTrigger name=”continuous” seconds=”60″ buildCondition=”IfModificationExists” initialSeconds=”60″ />

This specifies that we want the build to run every 60 seconds, after an initial 60 seconds, but only if there have been code changes.

Adding MSTest

Next, we will add the first of the tasks, MSBuild, this is going to build the debug configuration of the solution.

C:\Program Files x86)\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll

The next stage is to add the MSTest task to run our unit tests. This comes in two parts, the first is to create a batch file to delete the existing test results file, because MSTest will not overwrite it, and just stops.

Create a file called DeleteTestResultsFile.bat, and enter this code. Remember to add it in to your source control.

del testresults.trx

Then we need to set up a new task to call this batch file:


And now the call to MSTest:

<executable>C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe</executable>

Now, it’s with MSTest that I had the most issues. When MSTest runs it creates a new test directory in the format \<username>\<out>\ and copies all the test project executables and dlls. My main issue was that certain files were not being copied into the directory. This is solved by telling Visual Studio that the need to be deployed. Here is how:

  1. In Solution Explorer, right-click Solution Items, point to Add, and then click New Item. The Add New Item dialog box appears.
  2. In the Installed Templates pane, click Test Settings.
  3. (Optional) In the Name box, change the name of the test settings file.
  4. Click Add.
  5. Click on Deployment.
  6. Click the tick box to enable deployment.
  7. Click on add file and add any files which need to be available for the tests to run. (Figure 1)


Figure 1 – Adding Files to test deployment

Next we need ensure that the test results are merged into the build results. So we add a new section:

<!– the reference to xmllogger needs to be here, or strange errors occur.–>
<xmllogger />

Configuring the Web Desktop to show the Test results

We need to edit the dashboard.config file in C:\Program Files (x86)\CruiseControl.NET\webdashboard, update the buildPlugins section:

<xslReportBuildPlugin description=”MSTest Report” actionName=”MSTESTReport” xslFileName=”xsl\MsTestReport2008.xsl”/>


Figure 2 – CruiseControl.Net Web Dashboard


Figure 3 – CruiseControl.NEt Project Report


Figure 4 – CruiseControl.Net Build Report