3

For background: I've got quite a nice TeamCity setup; containing a ci build and a release build which uses WiX to build my installers and patch all the version numbers. When I do a new release build, I'd like to automatically create MSP patches against a previous set of installers. I'm thinking either tagged RTM in TeamCity, or as a list of version numbers.

The approach I'm leaning towards is creating a separate config and getting the msi artifacts of all the previous builds that fit the criteria (tag or version number). Tag would seem a lot neater, but I can't see anything in the documentation about how you use it?

I've got a script to build the MSP patch, but it relies on a PCP file which needs to be edited in ORCA to describe the patch.

  1. In terms of editing the PCP, is there anything else I can use other than the ORCA to edit? I've been looking at moving to the WiX method here: http://wix.sourceforge.net/manual-wix3/patch_building.htm which looks promising.
  2. Does anyone know if you can access artifacts in TeamCity by Tag in the same or another build?
  3. Does anyone have any other insights into automatically building/chaining MSP patch files in TeamCity?
4

2 に答える 2

1
  1. WiX ツールセットの PatchCreation 要素を使用して .PCP ファイルを作成できます。これにより、カスタマイズされた .PCP ファイルを作成するために必要な柔軟性が得られるでしょう。

  2. 申し訳ありませんが、TeamCity を使用しないでください。

  3. 申し訳ありませんが、TeamCity を使用しないでください。:)

于 2012-06-20T16:18:52.887 に答える
1

ロブの答えに追加するには:

#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. 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

patch.pcp を作成するための MSBuild

<?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>
于 2012-06-25T14:49:00.503 に答える