By default Cruise Control stores the all important ccnet.config file in %ProgramFiles%\CruiseControl.NET\Server, if you didn’t know CC.Net also monitors this file and will rebuild itself if it detects a change.
Now the main problem with the default location for ccnet.config is that this is not under source control, so if your build server happens to suddenly “disappear” (this has happened to me) then you’ve lost all of your project configuration.
What I like to do is store ccnet.config in source control and create a project in ccnet.config that monitors this file.
Benefits:
- CCNet.Config is safe and sound versioned under source control
- Any developer can check out the file and create new projects
- Best of all Cruise Control will detect any changes and magically rebuild itself! How cool is that!?
Here’s how I do it:
- Create a new folder structure under source control Build Servers\[SERVER_NAME]\Server
(By using the build server name you can store multiple server ccnet configs) - Checkin your %ProgramFiles%\CruiseControl.NET\Server\ccnet.config file to the Server folder in step 1
(Copy it to your working folder first!) - Modify the following line in %ProgramFiles%\CruiseControl.NET\Server\ccservice.config replacing the path with the location of your working copy on location on the build server.
<add key="ccnet.config" value="C:\Builds\CCNet\Server\ccnet.config"/>
- Create a new project in ccnet.config like the following:
<!--
*********************************************************************************************************************************************
Cruise Control Config file - Monitors for changes to the main cruise control project config file
*********************************************************************************************************************************************
-->
<project>
<name>Lon-Build-01 - Config File</name>
<webURL>http://Lon-Build-01/ccnet/server/local/project/Lon-Build-01+-+Config+File/ViewProjectReport.aspx</webURL>
<triggers>
<intervalTrigger seconds="60"/>
</triggers>
<workingDirectory>c:\builds\CCNet\Server</workingDirectory>
<modificationDelaySeconds>0</modificationDelaySeconds>
<sourcecontrol type="svn">
<executable>C:\Program Files\SlikSvn\bin\svn.exe</executable>
<trunkUrl>svn://Lon-Build-01/BuildServers/Trunk/Lon-Build-01/Server</trunkUrl>
<tagOnSuccess>false</tagOnSuccess>
</sourcecontrol>
<publishers>
<statistics />
</publishers>
<externalLinks>
<externalLink name="IIS Root Web on Localhost" url="http://localhost/" />
</externalLinks>
</project>
- Restart the Cruise Control service
Now you have a versioned ccnet.config file and an auto rebuilding build server!
PS Don’t forget to add the new proecjt in CC tray!
a173a603-b53b-4a58-a489-04be06837805|0|.0