Splitting up your CCNet config

If you use CruiseControl.Net to run your builds then you may come to a point where you want to pull a number of projects out into a separate file to keep the files cleaner and more readable.  Fortunately it's fairly easy to do using XML entity declarations.

You will want to add something similar to the following to the top of your config file.

<!DOCTYPE cruisecontrol [        
  <!ENTITY someProjects SYSTEM "file:someProjecs.config">

What this does is act as an abbreviation for some data or for data found at an external location. Here we are obviously using it from an external location.

<cruisecontrol xmlns:cb="urn:ccnet.config.builder">

The &someProjects; will be replaced by the contents of the file someProjects.config.  Because the contents of the file is being inserted into the xml document it must contain valid and balanced xml.  It must also be valid in the locatin that it is being inserted into the document.

The other option is to use the CCNet configuration preprocessor but I'll leave that for another blog post.