【问题标题】:Versioning an assembly info past the UInt16 barrier通过 UInt16 屏障对程序集信息进行版本控制
【发布时间】: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


    【解决方案1】:

    您可以从 0 开始翻转并重新启动,因此您的修订版将类似于 revision = 70000 % 50000

    您也可以将build 用作源代码控制修订版的一部分,例如build = 70000 / 50000

    因此,在本例中为x.x.1.20000

    【讨论】:

    • 谢谢我所做的,我正在考虑减去 uint16 的值,但 50000 对其他人来说很明显。
    猜你喜欢
    • 1970-01-01
    • 2010-11-16
    • 1970-01-01
    • 1970-01-01
    • 2012-01-31
    • 2013-06-11
    • 2015-02-13
    • 2012-05-07
    • 2015-06-29
    相关资源
    最近更新 更多