Patch Building

Creating a Patch with Wix

Note: You must have Windows Installer 3.0 installed\
  1. Do an administrative install of the RTM version (Target Image).
  2. Update Package Id in Main.wxs.
  3. Make new Installer.msi
  4. Do an administrative install of the latest version (Update Image with new files you want to patch).
  5. Create a patch creation properties (.pcp) file.
  6. Create the patch.
  7. Run the patch

1. Administrative install of RTM version

With the RTM installer.msi, run
md c:\patchdir
md c:\patchdir\rtm
msiexec /a installer.msi TARGETDIR=c:\patchdir\rtm

2. Update Package Id in source .wxs file.

Make a new Guid for the Id= attribute under the %lt;Package> tag in the wxs files.

3. Make new installer.msi

4. Administrative install of latest version

With the new installer.msi, run
md c:\patchdir\latest

msiexec /a installer.msi TARGETDIR=c:\patchdir\latest

5. Create a Patch Creation Properties (.pcp) file

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2003/01/wi">
  <?define WixDir = . ?>
  <?define Proj1 = "rtm" ?>
  <?define Proj2 = "latest" ?> 

  <PatchCreation 
     Id="put-guid-here"
       CleanWorkingFolder="yes"
       OutputPath="patch.pcp"
       WholeFilesOnly="yes"
       >

        <PatchInformation
              Description="Patches the andmagichappens.cmd file"
              Comments="Patch for new dll"
              ShortNames="no"
              Languages="1033"
              Compressed="yes"
              Manufacturer="insert-organization-name-here"/>

        <PatchMetadata
              AllowRemoval="yes"
              Description="Patches the andmagichappens.cmd file"
              ManufacturerName="insert-organization-name-here"
              TargetProductName="insert-product-name-here"
              MoreInfoURL="insert-info-url-here"
              Classification="Hotfix"
              DisplayName="insert-product-abbreviaiton-here Patch 1.01"/>

        <Family DiskId="2" MediaSrcProp="insert-product-abbreviaiton-hereprop_2_1_01" 
               Name="insert-organization-name-here and insert-product-abbreviaiton-here1" SequenceStart="1010">
               <UpgradeImage src="$(var.Proj2)\Installer.msi" Id="insert-product-abbreviaiton-hereUpgrade">
                      <TargetImage src="$(var.Proj1)\Installer.msi" Order="2"      
                                  Id="insert-product-abbreviaiton-hereTarget" IgnoreMissingFiles="no" />
               </UpgradeImage>
        </Family>

         <PatchSequence
             PatchFamily="insert-organization-name-here and insert-product-abbreviaiton-here1" Sequence="2.1.0.010" Supersede="0"
                 Target="insert-product-abbreviaiton-hereTarget" />

    </PatchCreation>
</Wix>

Notes:

6. Create the patch msp file

candle patch.wxs

light patch.wixobj -out patch.pcp

msimsp -s patch.pcp -p patch.msp -l msimsp.log

7.Run the patch

msiexec /update patch.msp REINSTALL=ALL /L*v patch.log