I have two projects set up in CruiseControl.NET: CI build and nightly build.
Both of them execute the same NAnt script, but with different parameters.
The CruiseControl.NET label (currently generated by the DefaultLabeler) is embedded into AssemblyInfo as the build part of the version (for example, MajorVersion.MinorVersion.CCNET_Label.SVN_Revision).
For more consistent versioning I would like both projects to share the same CruiseControl.NET label value.
I have investigated the labelers that are available as part of the CruiseControl.NET installation, but I could not find one that does what I want.
How do I share a label value between multiple CruiseControl.NET builds?
If there is a better way to do this, I would like to know.
I found a way. See my answer below.
I could not find an existing solution that to do what I needed, so I ended up writing a custom CruiseControl.NET labeller.
Here's how it is done:
I ran into the same issue, but I found that using the
<stateFileLabeller>
in conjunction with the<assemblyVersionLabeller>
proved to be a much simpler solution.The only gotcha about using the stateFileLabeller is that you can't specify a directory for your state files in a project, because CruiseControl.NET won't find it. I left it in the default directory, and it works great.
I've modified the class Arnold made making it more of a replica of the defaultlabeller:
The benefit should be that you now can specify prefix as well as "incrementonfailure". Also I've added a "increment" property that can be used for deployment builds that should not increment the build number at all. If you want to modify it yourself I would advise to have a look at their implementations: CruiseControl.NET repository folder containing labellers