TeamCity 构建 MSP 文件

3
背景情况:我的TeamCity设置相当不错,包含一个ci构建和一个使用WiX构建我的安装程序并修补所有版本号的发布构建。当我进行新版本发布构建时,我希望自动创建针对先前一组安装程序的MSP补丁。我考虑到标记为RTM或版本号列表,但是我无法在文档中找到有关如何使用它们的任何信息。
我倾向于的方法是创建单独的配置,并获取符合条件(标记或版本号)的所有先前构建的msi工件。标记似乎更整洁,但是我看不到文档中有关如何使用它的任何内容?
我有一个脚本来构建MSP补丁,但它依赖于需要在ORCA中编辑的PCP文件来描述补丁。
关于编辑PCP,除了ORCA之外还有其他可以使用的东西吗?我一直在考虑转换到WiX方法,在这里:http://wix.sourceforge.net/manual-wix3/patch_building.htm 看起来很有前途。是否有人知道是否可以通过标记在同一或另一个构建中访问TeamCity中的工件?还有人有关于如何自动在TeamCity中构建/链接MSP补丁文件的其他见解吗?
2个回答

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. 旧的构建存储库 - 如上所述

Teamcity项目有以下步骤:

  1. 使用MSBuild运行build.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

使用MSBuild创建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>

1
1. 你可以使用WiX工具集中的PatchCreation元素构建.PCP文件,这可能会为你提供必要的灵活性以创建定制的.PCP文件。 2. 抱歉,不使用TeamCity。 3. 抱歉,不使用TeamCity. :)

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接