Software Engineering with Sean Eby
opinions, trips, tricks and tools for Software Engineering and .NET

Tip #1: Properties for CruiseControl.NET

Tuesday, July 03, 2007 8:46 PM

I am a huge fan of Continuous Integration and have been using CruiseControl.NET (CCNet) successfully for the past year.  Recently, I've run across a limitation in the way the cnet.config file is used. Normally, when a developer needs to reuse some piece of information, such as a file path, he will put this information in a Property or Constant. However, unlike MSBuild files which supports a PropertyGroup, the ccnet.config provides no support for Properties or Constants.

For example, in my ccnet.config file, I need to specify the artifactDirectory, where build artifacts will be stored.  

<artifactDirectory>C:\Projects\Artifacts\MyFirstProject</artifactDirectory>

Let's say I have 10 projects to build. I will need to copy and paste the path above 9 more times.  This "copy and paste" mentality introduces too many places for error for my taste. So, after searching the net for a while, I finally found a solution. Enter the XML Entity.

So, now, we can do the following.

Enter this at the top of the ccnet.config file:

<!DOCTYPE cruisecontrol[
  <!
ENTITY ArtifactsDirectory "C:\Projects\Artifacts">
]>

Use the XML Entity in place of the hard coded string:
<artifactDirectory>&ArtifactsDirectory;\MyFirstProject</artifactDirectory>
<artifactDirectory>&ArtifactsDirectory;\MySecondProject</artifactDirectory>


etc...   

Feedback

# re: Tip #1: Properties for CruiseControl.NET

Hello,

I have been looking for something like this. I would like to have CC.net be more like CruiseControl. I have a lot of projects to compile and having a master config file that I can add in something like this <project name="ProjX">&IncludeProjX</project> and have the CDATA read in a file, that would be cool.

Thanks for the tip. It will save a lot of headaches. 12/5/2007 10:13 AM | Peter Hecht

Post a comment





 

Please add 1 and 1 and type the answer here: