There are a number of blog posts online describing how to configure Cruise Control .NET with SubVersion, none of them worked for me when I followed them, I had to tweak the desribed steps a little. Below are the steps I followed to install Cruise Control .NET with Subversion.
Required Software
- Cruise Control .NET
- Subversion Console Client (e.g. Slik SVN)
- Microsoft IIS
- Microsoft Visual Studio 2008
Setup
- Make sure all of the required software is installed.
- Create the folder _Projects and bind it to the Subversion repository and perform an update.
- Modify the PATH environment variable to include the path to the folder
C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE- Control Panel
- System
- Advanced Tab
- Environment Variables
- Check that the virtual directory http://localhost/ccnet exists, if not then create it and point it to the folder C:\Program Files\CruiseControl.NET\WebDashboard
- Check that the service Cruise Control .NET Service is installed and running.
Cruise Control .NET Configuration
- Open the file C:\Program Files\CruiseControl.NET\Server\ccnet.config in a text editor. This file contains the settings for the different projects that will be monitored, the basic structure is as follows:
<project> <workingDirectory /> <triggers /> <sourcecontrol /> <tasks /> </project> - Project Node: The project node just requires an attribute name with the name of the project.
<project name="YourProject"></project>
- WorkingDirectory Node: The workingDirectory node is the path to the folder where the project resides.
<workingDirectory> D:\_Projects\trunk\YourProject </workingDirectory> - Triggers Node: The triggers node simply specifies the interval Cruise Control .NET will use to poll the Subversion repository for committed files.
<triggers> <intervalTrigger seconds="60" /> </triggers> - SourceControl Node: The sourceControl node has the settings related to getting the source from Subversion.
- The executable node is the path to the Subversion Console Client.
- The workingDirectory node is the path to the folder where code from Subversion will be saved.
- The trunkUrl node is the path to the project source in Subversion.
- The autoGetSource node can always be set to true.
- The username and password nodes are the username and password to connect to Subversion with.
<sourcecontrol type="svn"> <executable> C:\Program Files\SlikSvn\bin\svn.exe </executable> <workingDirectory> D:\_Projects\trunk\YourProject </workingDirectory> <trunkUrl> http://localhost:8080/svn/Repository/trunk/YourProject </trunkUrl> <autoGetSource>true</autoGetSource> <username>david.turvey</username> <password></password> </sourcecontrol> - Tasks Node: The tasks node has a node msbuild that tells Cruise Control .NET to use msbuild.exe to build the project/solution along with all the settings needed.
- The executable node is the path to MSBuild.exe
- The workingDirectory node is the path to the folder containing the project/solution.
- The projectFile node is the filename of the project/solution file.
- The buildArgs node contains the arguments to pass to MSBuild.
- The timeout node contains a value in seconds for the timeout of the build.
- The logger node is the path to ThoughtWorks.CruiseControl.MsBuild.dll
<tasks> <msbuild> <executable> C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe </executable> <workingDirectory> D:\_Projects\trunk\YourProject </workingDirectory> <projectFile>YourProject.csproj</projectFile> <buildArgs> /noconsolelogger /p:Configuration=Debug </buildArgs> <targets></targets> <timeout>300</timeout> <logger> C:\Program Files\CruiseControl.NET\webdashboard \bin\ThoughtWorks.CruiseControl.MsBuild.dll </logger> </msbuild> </tasks>
If you browse to the Cruise Control .NET dashboard (http://localhost/ccnet) your project should be in the list, probably with a state of unknown, simply click Force Build on the right to check whether your build succeeds or fails. When someone checks in code a triggered build will occur.