title: CruiseControl.NET automated build version numbers
body: <p>This is a complicated one, so I hope I explain it well enough.</p>
  
  <p><strong>Background</strong></p>
  
  <p>I'm in the process of automating a build process with CruiseControl.NET and NAnt. The biggest headache I'm encounting is version number format and CruiseControl.NET requiring the label from a labeller before running a build project.</p>
  
  <p>Currently a developer runs Visual Studio 2008 to produce a Debug, Release and Custom build. Each of these configurations invoke BuildInc (a custom tool) that reads a file (version.ver) increments the read version number, generates an .rc2 file for the executable properties and writes a new version back to version.ver. Obviously version.ver and .rc2 change and need checking backing into source before the developer labels the release in source control. The label in source control is the version number i.e. 1.2.3.4 -> 1-2-3-4.</p>
  
  <p>Currently the new automated build triggers a CruiseControl.NET project that invokes a NAnt script. The NAnt script runs Visual Studio and publishes the builds to a release directory. That works fine, the NAnt script is able to get the previous and new version number by reading version.ver. The problem is getting CruiseControl.NET to label the source and display the label on the dashboard. The new version number/label is generated during the build and which number to increment is held within the Visual Studio project in the pre-link tasks arguments.</p>
  
  <p><strong>Version numbers</strong> </p>
  
  <p>Version numbers are in a unique format and are different between builds done on trunk and a development branches. Builds done on a branch are for enhancements that are merged back into trunk when completed.</p>
  
  <p>Trunk  </p>
  
  <ul>
  <li>Format: [Major].[Merge].[Release].00  i.e. 42.01.02.00</li>
  <li>Major: System number</li>
  <li>Merge: Incremented if a branch is merged</li>
  <li>Release: Incremented on bug fixes</li>
  </ul>
  
  <p>Branch </p>
  
  <ul>
  <li>Format [Major].00.[Stream].[Release] i.e. 42.00.01.01 </li>
  <li>Major: System number </li>
  <li>Stream: Stream number, linking it to other components for the enhancement</li>
  <li>Release: Incremented on bug fixes</li>
  </ul>
  
  <p>Numbers are prefixed by zero i.e. 01, 02. This doesn't play well with any tools I'm encountered. (I'm hoping to change that)</p>
  
  <p><strong>Questions</strong></p>
  
  <p>After all that I hope you understand my problems.</p>
  
  <ol>
  <li>What general improvements could I make to the automated process?</li>
  <li>Do you think the version number should be known before the build is started?</li>
  <li>Should the automate build system auto increment the version number?</li>
  <li>Should I consider changing the version number format?</li>
  <li>Any other comments, I really need more opinions.</li>
  </ol>
  
  <p>Let me know if more information is needed.</p>
  
  <p><strong>Notes</strong> </p>
  
  <p>Language is C++, platform is Windows and source control is CVS.</p>