使用cc.net和msbuild设置程序集文件版本和程序集版本

问题描述

我们正在使用cc.net(巡航控制)和msbuild来构建单击一次应用程序。这是msbuild任务:

<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>

所以我试图设置发布输出的程序集文件版本和程序集版本。

问题在于变量$ CCNetLabel似乎不起作用。如果我将AssemblyFiLeversion和AssemblyVersion设置为3.2.0.0之类的,则输出具有该版本号,但是$ CCNetLabel不能正常工作。

有没有人知道如何进行这项工作?

谢谢 伊恩

解决方法

如果问题是 $(CCNetLabel) 为空,请尝试使用“动态”变量。所以,而不是:

AssemblyFileVersion=$CCNetLabel;

使用:

AssemblyFileVersion=$[$CCNetLabel];

否则看看另一个问题,它有更多关于 AssemblyInfo.cs 的信息,可能会有所帮助:

Using CCNetLabel to set AssemblyVersion and PublishVersion with CruiseControl.NET