Patch Building
Creating a Patch with Wix
Note: You must have Windows Installer 3.0 installed\
- Do an administrative install of the RTM version (Target Image).
- Update Package Id in Main.wxs.
- Make new Installer.msi
- Do an administrative install of the latest version (Update Image with new files you want to patch).
- Create a patch creation properties (.pcp) file.
- Create the patch.
- Run the patch
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:
- The 01 in red in the above file is a patch id. It should be incremented by 1 with each patch. Also, the Id= under <PatchCreation> should be set to a new Guid for each patch created.
- The SequenceStart value is influenced by the number of files that the previous
patch delivered, as well as the number of files that this patch will deliver.
This tells PatchWiz.dll to start assigning File sequence numbers from this
number. So if this patch ships 11 files, and the next patch uses a SequenceStart of
1020, it will step on the 11th file’s assigned sequence number. In this case
the next patch would use a SequenceStart of 1030, and 03 as the patch id to
avoid conflicts with this patch. This scheme helps prevent this by coordinating
the SequenceStart (file sequence numbers) with the patch sequence number.
Also, note that the SequenceStart of the first patch must be greater than the
number of files in the original installation. If the original installation
contained more than 1000 files(rare), then the SequenceStart for the first
patch must be set to a higher value (e.g 2010.)
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