【问题标题】:Auto increment build number using WIX使用 WIX 自动增加内部版本号
【发布时间】:2011-03-06 05:56:48
【问题描述】:

我正在使用 WIX 工具为我们的项目创建安装文件。

我想要动态(增量)内部版本号。所以有人可以指导我。

请不要提供像 1.0.0.* 这样的解决方案,因为这会在末尾给出任何动态数字。我希望它像 1.0.0.1、1.0.0.2、1.0.0.3、.....

【问题讨论】:

  • 您已经使用持续集成工具了吗?如果是这样,如果您告诉我们哪个会更容易;如果没有,那么您可能想先调查一下。 TeamCity 在处理内部版本号方面非常有效。

标签: installation wix version


【解决方案1】:

您不能在本机上使用 WiX 执行此操作。

但是,您可以将版本定义为变量。例如:

<Product Id="*"
         UpgradeCode="$(var.Property_UpgradeCode)"
         Name="!(loc.ApplicationName)"
         Language="!(loc.Property_ProductLanguage)"
         Version="$(var.version)"
         Manufacturer="!(loc.ManufacturerName)" >

然后就可以在命令行中传入版本号了。这是一个使用Nant的示例

<candle
          out="${dir.obj}\"
          rebuild="true"
          extensions="WixUIExtension;WixNetFxExtension">
            <defines>
                <define name="ProcessorArchitecture" value="${release.platform}" />
                <define name="SourceDir" value="${dir.source}" />
                <define name="version" value="${version}" />
                <define name="releasetype" value="${release.type}" />
                <define name="Language" value="${language}" />
            </defines>

            <sources>
                <include name="*.wxs" />
            </sources>
        </candle>

然后,您只需像处理应用程序一样处理版本号 :)

【讨论】:

    【解决方案2】:

    您可以使用msbuild community tasks 版本类 例如

    <PropertyGroup>
        <MinorIncrement Condition=" '$(ReleaseType)' == 'Internal' ">None</MinorIncrement>
        <MinorIncrement Condition=" '$(MinorIncrement)' == '' ">Increment</MinorIncrement>
        <BuildIncrement>Increment</BuildIncrement>
        <BuildIncrement Condition=" '$(MinorIncrement)' == 'Increment' ">Reset</BuildIncrement>
    </PropertyGroup>
    
    <Target Name="BumpVersion">
        <Version VersionFile="version.txt" MinorType="$(MinorIncrement)" BuildType="$(BuildIncrement)">
            <Output TaskParameter="Major" PropertyName="Major"/>
            <Output TaskParameter="Minor" PropertyName="Minor"/>
            <Output TaskParameter="Build" PropertyName="Build"/>
            <Output TaskParameter="Revision" PropertyName="Revision"/>
        </Version>
    
        <AssemblyInfo CodeLanguage="CS" OutputFile="VersionInfo.cs" AssemblyVersion="$(Major).$(Minor).$(Build).$(Revision)" AssemblyFileVersion="$(Major).$(Minor).$(Build).$(Revision)"/>
        <Message Text="Version: $(Major).$(Minor).$(Build).$(Revision)"/>
    </Target>
    

    在顶部,我正在为发布类型设置值。不幸的是,这些似乎只记录在代码中。

    CruisControl.Net 正在外部设置 ReleaseType。

    如果我们的 ReleaseType 为“Internal”,则次要增量未完成,但内部版本号被碰撞,如果不是,则我们增加次要号并重置内部版本号。

    Version 元素将从 version.txt 中读取版本,格式为“1.0.1.3”,对其进行处理,然后将其读入一些变量,这些变量就是输出位的含义(我认为!)用于修改程序集信息的位

    【讨论】:

      【解决方案3】:

      预处理器支持以下功能:

          <Product Version="$(fun.AutoVersion(1.0))"...</Product>
      

      使用与 .NET AssemblyVersion 属性相同的方案获取自动生成的版本号。参数 x.y 指定主要和次要版本号,构建设置为自 2000 年 1 月 1 日以来的天数,修订版设置为自午夜以来的秒数除以 2。这两个值均使用 UTC 计算。

      https://wixtoolset.org/documentation/manual/v3/overview/preprocessor.html

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2011-08-21
        • 1970-01-01
        • 1970-01-01
        • 2010-11-27
        • 1970-01-01
        • 2016-11-26
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多