过去,我通常使用变更集或 svn 编号来对二进制文件进行版本控制,例如1.1.123.3
其中较大的数字是来自源代码控制系统的变更集或版本。
然而,对于我现在使用的系统,我们已经远远超过了类似 70000+ 变更集的 uint 障碍,因此在用作程序集版本属性或程序集文件版本属性时会导致溢出和编译器错误。
看:http://msdn.microsoft.com/en-us/library/system.reflection. assemblyversionattribute.aspx 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>
您可以翻转并从 0 重新启动,因此您的修订版将如下所示revision = 70000 % 50000
.
你也可以使用build
作为源代码控制修订的一部分,例如build = 70000 / 50000
.
所以结果会是x.x.1.20000
在这个例子中。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)