CruiseControl.NET is an Automated Continuous Integration server, implemented using the Microsoft .NET Framework. It can be downloaded from: http://goo.gl/yRXo6
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:
- .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.
Edit the CCNET.config file found in into \Program Files (x86)\CruiseControl.NET\.
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.
Now, we add a trigger to tell it when to do the build.
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.
Next, we will add the first of the tasks, MSBuild, this is going to build the debug configuration of the solution.
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.
Then we need to set up a new task to call this batch file:
And now the call to MSTest:
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:
- In Solution Explorer, right-click Solution Items, point to Add, and then click New Item. The Add New Item dialog box appears.
- In the Installed Templates pane, click Test Settings.
- (Optional) In the Name box, change the name of the test settings file.
- Click Add.
- Click on Deployment.
- Click the tick box to enable deployment.
- 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:
We need to edit the dashboard.config file in C:\Program Files (x86)\CruiseControl.NET\webdashboard, update the buildPlugins section:
Figure 2 – CruiseControl.Net Web Dashboard
Figure 3 – CruiseControl.NEt Project Report
Figure 4 – CruiseControl.Net Build Report