【发布时间】:2011-05-25 07:39:05
【问题描述】:
在过去,我通常使用变更集或 svn 编号来版本二进制文件,例如1.1.123.3 其中较大的数字是来自源代码控制系统的变更集或版本。 但是,随着系统 im 现在使用我们已经远远超过了 70000+ 变更集之类的 uint 障碍,因此当用作程序集版本属性或程序集文件版本属性时会导致溢出和编译器错误。 看: http://msdn.microsoft.com/en-us/library/system.reflection.assemblyversionattribute.aspx
任何仍然将二进制链接到变更集的替代策略?
我已经调整了我的任务以使用给定的解决方案:
<Target Name="Version">
<!-- Changeset exceeds u16int so cannot be used in Versioninfo-->
<Attrib ReadOnly="false" Files="$(VersionFile)"/>
<!--Assembly version must be made of uint16 this means that the version number must less than 65536-->
<!-- current changest is way past this so i will make the number changset-50000 and add a number -->
<!-- so 70000 becomes 20000.1 and 100001 becomes 1.2-->
<PropertyGroup>
<Version>$(Branch).$([MSBuild]::Subtract($(ChangeSet),$(Offset))).$(OffsetCount)</Version>
</PropertyGroup>
<AssemblyInfo CodeLanguage="CS"
OutputFile="$(VersionFile)"
AssemblyCompany="$(Company)"
AssemblyProduct="$(Product)"
AssemblyCopyright="$(Copyright)"
AssemblyVersion="$(Version)"/>
<Attrib ReadOnly="true" Files="$(VersionFile)"/>
</Target>
【问题讨论】:
标签: c# .net version-control msbuild