TeamCity构建MSP文件

时间:2012-05-22 15:55:45

标签: wix teamcity artifacts msp

对于背景:我有一个很好的TeamCity设置;包含ci构建和发布版本,它使用WiX构建我的安装程序并修补所有版本号。当我进行新版本构建时,我想自动为前一组安装程序创建MSP补丁。我想在TeamCity中标记RTM,或者作为版本号列表。

我倾向于采用的方法是创建一个单独的配置,并获取符合条件(标签或版本号)的所有先前构建的msi工件。标签似乎更整洁,但我在文档中看不到有关如何使用它的内容?

我有一个脚本来构建MSP补丁,但它依赖于需要在ORCA中编辑的PCP文件来描述补丁。

  1. 在编辑PCP方面,除了ORCA之外还有其他什么可以编辑吗?我一直在考虑转向WiX方法:http://wix.sourceforge.net/manual-wix3/patch_building.htm看起来很有希望。
  2. 是否有人知道您是否可以通过Tag在相同或其他版本中访问TeamCity中的工件?
  3. 有没有人对在TeamCity中自动构建/链接MSP补丁文件有任何其他见解?

2 个答案:

答案 0 :(得分:1)

  1. 您可以使用WiX工具集中的PatchCreation元素构建.PCP文件。这可能会为您提供创建自定义.PCP文件所需的灵活性。

  2. 抱歉,请勿使用TeamCity。

  3. 抱歉,请勿使用TeamCity。 :)

答案 1 :(得分:1)

添加Rob的答案:

#2。 TeamCity可以按标签检索项目:

http://servername:8080/httpAuth/app/rest/buildTypes/id:bt13/builds?status=SUCCESS&tag=RTM

#3。我在WiX工具集中使用了PatchCreation元素(上面提到的Rob),并且他对此非常灵活。这是我构建的内容的概述,它似乎在测试中都很有效,

teamcity项目有许多构建参数,它们是:

  1. 新版本号 - 默认为changeme,因此如果没有更改,则会破坏构建。

  2. 旧版本号 - 如上所述

  3. 新构建存储库 - 这是buildtypeid,查看项目的查询字符串,它将具有buildTypeId = btXX。 XX是应该在这里提供的数字。

  4. 旧构建仓库 - 如上所述

  5. teamcity项目包含以下步骤:

    1. 运行build.msbuild的MSBuild运行器(见下文)

    2. 在patch.wxs上运行Candle以创建patch.wixobj文件

    3. 在patch.wixobj上运行Light以创建patch.pcp

    4. 解压缩新版本(命令:msiexec / q / a new.msi) -

    5. 解压缩旧版本(命令:msiexec / q / a old.msi) - 选择其他工作目录

    6. 创建补丁(命令:msimsp -s patch.pcp p hotfix-%system.msiOldVersion% - %system.msiNewVersion%。msp -l patch.log

    7. MSBuild to create patch.pcp

      <?xml version="1.0" encoding="utf-8"?>
      <Project ToolsVersion="4.0" DefaultTargets="Build"  xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
        <!--<Import Project="references\MSBuild.Community.Tasks.Targets"/>-->
        <UsingTask AssemblyFile="references\MSBuild.Community.Tasks.dll" TaskName="WebDownload"/>
        <UsingTask AssemblyFile="references\MSBuild.Community.Tasks.dll" TaskName="TemplateFile"/>
        <Target Name="Build">
          <!-- preconditions for build -->
          <Error Condition="'$(msiOldVersion)' == 'changeme'" Text="Use run custom build, setting the client version of the msi"/>
          <Error Condition="'$(msiOldVersion)' == ''" Text="Use run custom build, setting the client version of the msi"/>
          <Error Condition="'$(msiNewVersion)' == 'changeme'" Text="Use run custom build, setting the new version of the msi"/>
          <Error Condition="'$(msiNewVersion)' == ''" Text="Use run custom build, setting the new version of the msi"/>
          <Message Text="Old Version: $(msiOldVersion)"/>
          <Message Text="New version: $(msiNewVersion)"/>
      
          <!-- download files from teamcity... -->
          <WebDownload FileUri="http://server:8080/httpAuth/repository/download/bt$(msiOldRepo)/trunk/Path/bin/Release/en-us/installer-v-v.$(msiOldVersion).msi" UserName="download" Password="abcdefgh" FileName="downloads/oldversion.msi"  />
          <WebDownload FileUri="http://server:8080/httpAuth/repository/download/bt$(msiNewRepo)/trunk/Path/bin/Release/en-us/installer-v.$(msiNewVersion).msi" UserName="download" Password="abcdefgh" FileName="downloads/newversion.msi"  />
      
          <!-- fill in blanks in patch.wxs -->
          <ItemGroup>
            <Tokens Include="oldVersion">
              <ReplacementValue>$(msiOldVersion)</ReplacementValue>
            </Tokens>
            <Tokens Include="newVersion">
              <ReplacementValue>$(msiNewVersion)</ReplacementValue>
            </Tokens>
          </ItemGroup>
          <TemplateFile Template="template.wxs" OutputFileName="patch.wxs" Tokens="@(Tokens)"/>    
        </Target>
      

      MSBuild脚本使用的Template.wxs

      <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
        <PatchCreation
            Id="deadbeef-dead-beef-dead-beefdeadbeef"
            CleanWorkingFolder="no"
            OutputPath="patch.pcp"
            WholeFilesOnly="no">
          <PatchInformation
              Description="Small Update Patch"
              Comments="Small Update Patch"                        
              Manufacturer="Your Manufacturer"/>
          <PatchMetadata
              AllowRemoval="yes"
              Description="Hotfix"
              ManufacturerName="Your Manufacturer"
              MoreInfoURL="http://yourwebsite.com"
              TargetProductName="Your Product Name"        
              Classification="Hotfix"
              DisplayName="Hotfix - TBC"/>
      
          <Family DiskId="5000"
              MediaSrcProp="Sample"
              Name="Sample"
              SequenceStart="5000">
            <UpgradeImage SourceFile="downloads\newunpack\newVersion.msi" Id="SampleUpgrade">
              <TargetImage SourceFile="downloads\oldunpack\oldVersion.msi" Order="2"
                  Id="SampleTarget" IgnoreMissingFiles="no" />
            </UpgradeImage>
          </Family>
      
          <PatchSequence PatchFamily="SamplePatchFamily"        
              Supersede="yes" />    
        </PatchCreation>
      </Wix>