I often find people are intimidated by CruiseControl.NET. One of the phrases I have heard before is that it is "only really sensible for new projects" - the explanation behind this usually being that it is too difficult to set up for existing solutions. This guide is designed to show how easy it is to get started on any .NET solution, no matter where in the development phase.
The primary goal of this guide is simply to create a nightly build of a project maintained in Visual SourceSafe 2005 with CruiseControl.NET - one of the simplest configurations you can imagine. Those of you doing continuous integration will already recognise this as the first in many baby step's that can be taken to improve existing process using CruiseControl.NET (hopefully the subject of a future article). Those of you who want more information on what continuous integration is and can do to help may find these articles useful:
Step 1 is to download and install the CruiseControl.NET application from http://sourceforge.net/projects/ccnet/ - pretty straight forward! The version dealt with in the post is 1.3 which was released 21/06/2007.
Step 2 is to get the project(s) buildable using MSBuild from the command line, this is just a simple check to make sure the projects work! eg:
msbuild c:\test\app.sln /t:Clean /p:Configuration=Debug
Step 3 create a VSS user specifically for CruiseControl.NET to log in as.
Step 4 configure the ccnet.config file which is found in the installation directory (default Program Files\CruiseControl.NET\server). Simple config will require the a project with sourcecontrol section, an interval trigger and an msbuild, eg:
<sourcecontrol type="vss" autoGetSource="true" applyLabel="true">
<executable>E:\Program Files\Microsoft Visual SourceSafe\ss.exe</executable>
<intervalTrigger seconds="60" />
<buildArgs>/noconsolelogger /p:Configuration=Debug /v:diag</buildArgs>
Don't be frightened - when you actually look at it - there is very little required, just the source safe details and solution location! Note that we have set the build interval to 60 seconds - this will allow us to test the configuration easily in the next step.
Step 5 download the XML Logger for MSBuild from http://ccnetlive.thoughtworks.com/MSBuildXmlLogger%2DBuilds/ and copy to the the project workingDirectory (in the example above this is set to E:\work\LocalVSS\TestProject). This logger is used by CruiseControl as described in http://confluence.public.thoughtworks.org/display/CCNET/Using+CruiseControl.NET+with+MSBuild.
Step 6 is to check the configuration setting using the command line tool. The ccnet.exe command line tool can be found in the server directory beneath the install directory (default Program Files\CruiseControl.NET\server). The console will run the settings and attempt the build every 60 seconds (as configured previously). The console output is good and it should not take you long to get a basic configuration like the example above working.
You can use the Web Dashboard to force through a build (so you don't need to make a change in SourceSafe!). The Web Dashboard will be available at http://server/ccnet and the Force button is available under the admin header for each server.
Step 7 finally change the ccnet.config to replace the 60 second interval trigger with a schedule trigger eg:
<scheduleTrigger time="23:30" buildCondition="ForceBuild" name="Scheduled">
Which again is fairly straight forward and will run the build every day at 2330.
So that's it CruiseControl.NET up and running to run nightly builds in 7 steps! You can now use the service rather than the command line to listen for builds, and you can use the web dashboard on the CruiseControl.NET server (http://server/ccnet) to see status of builds and force builds (when the service is running).
Clearly there is loads more that CruiseControl.NET can do (notably run your unit tests) all of which you can find using the ThoughtWorks documentation site