2012-05-22 115 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>