2012-05-22 63 views
3

对于背景:我有一个很好的TeamCity安装程序;包含一个ci版本和一个发布版本,它使用WiX构建我的安装程序并修补所有版本号。当我做一个新版本构建时,我想自动创建一个针对以前安装程序集的MSP修补程序。我正在考虑在TeamCity中标记RTM,或者作为版本号列表。TeamCity构建MSP文件

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

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

  1. 就编辑PCP而言,除ORCA之外还有什么可以用来编辑的?我一直在寻找移动到这里的WiX方法:http://wix.sourceforge.net/manual-wix3/patch_building.htm看起来很有希望。
  2. 有谁知道你是否可以通过标签在同一个或另一个版本中访问TeamCity中的工件?
  3. 有没有人有任何其他的见解,在TeamCity中自动构建/链接MSP补丁文件?

回答

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

  2. 对不起,请勿使用TeamCity。

  3. 对不起,请勿使用TeamCity。 :)

1

为了增加罗布的回答是:

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

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

#3。我在WiX工具集中使用了PatchCreation元素(Rob建议上图),他对此非常灵活。这里是什么,我已经建立了一个大纲,这一切似乎在测试中工作得很好,

的TeamCity的项目有很多构建参数,它们分别是:

  1. 新版本号 - 默认作为变化,所以如果它没有被改变,它会破坏构建。

  2. 旧版本号 - 如上

  3. 新的Build回购 - 这是buildtypeid,看看查询字符串为您的项目,这将有buildTypeId = btXX。 XX是这里应该提供的数字。

  4. 旧的生成回购 - 如上

的TeamCity的项目有以下几个步骤:

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

  2. 运行蜡烛上的patch.wxs创建一个patch.wixobj文件

  3. 运行灯亮patch.wixobj创建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 to创建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>