Setting the assembly file version and assembly version using cc.net and msbuild

160 views Asked by At

We are using cc.net (cruise control) and msbuild to build a click once application. This is the msbuild task:

<msbuild>
    <executable>C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe</executable>
    <workingDirectory>D:\Directory</workingDirectory>
    <projectFile>proj.lsxtproj</projectFile>
    <buildArgs>/t:publish /p:PublishLocation=D:\Publish\;AssemblyFileVersion=$CCNetLabel;AssemblyVersion=$CCNetLabel</buildArgs>
    <targets>Build</targets>
    <timeout>600</timeout>
</msbuild>

So I am trying to set the assembly file version and assembly version of the published output.

The issue is that the variable $CCNetLabel does not seem to work. If I set AssemblyFileVersion and AssemblyVersion to something like 3.2.0.0 then the output has this version number but $CCNetLabel just does not work.

Has anyone got any ideas how to make this work?

Thanks Ian

1

There are 1 answers

0
Mick On

If the problem is that $(CCNetLabel) is blank try using the 'dynamic' variable. So instead of:

AssemblyFileVersion=$CCNetLabel;

use:

AssemblyFileVersion=$[$CCNetLabel];

Otherwise have a look at this other question which has more information re AssemblyInfo.cs and may help:

Using CCNetLabel to set AssemblyVersion and PublishVersion with CruiseControl.NET