AssemblyInfo Version Attribute labeller

Description

This labeller (yeah, they spelled it wrong not me) will parse a file (typically AssemblyInfo.cs or AssemblyInfo.vb) containing .NET assembly version attributes such as AssemblyVersion or AssemblyFileVersion and allows CCNet to use that version number as (part of) the label for a build.

As of the creation of this document, this source/binary works with CCNet v1.3 and v1.4.

Installation Instructions

  1. copy ccnet.Stafney.plugin.dll into the CruiseControl.NET server directory
  2. edit the configuration file appropriately
  3. enjoy

Configuration Elements

Node Type Required Default Description
file string true   The absolute or relative path of a file containing version attributes
attr string false AssemblyVersion The attribute name to pull the version from
count int false 4 The number of version components to return (see System.Version.ToString(int))
prefix string false   Text to prepend to the version
suffix string false   Text to append to the version

Configuration Example

Minimal example:

<labeller type="versionInfoLabeller" file="AssemblyInfo.cs" />

Full example:

Using a ccnet.config file labeller block of:
<labeller type="versionInfoLabeller">
    <file>AssemblyInfo.cs</file>
    <attr>AssemblyVersion</attr>
    <count>3</count>
    <prefix>foo-</prefix>
    <suffix>-bar</suffix>
</labeller>

Ouput:

Using the Full example above and assuming a file named AssemblyInfo.cs in the CCNet working directory of the executing project contained:
[assembly: AssemblyVersion("1.2.3.4")]

Should yield a label of:
foo-1.2.3-bar

About the Author

Todd? He's just a guy that writes software. You can visit him at http://www.stafney.com/