Easy MSI - A basic guide to Windows Installer

Click here to edit subtitle

Chapter 7 - Patches and Updates


Download Solution 7.1

Download Solution 7.2 

Download Solution 7.3 

Download Solution 7.4 


Excercise 7.1: Major Upgrade


In this exercise you will create a major upgrade of your blastermaster.msi package that removes the "Blaster Master Service".


First create a copy the existing blastermaster.msi package under the new name blastermaster_v2.msi.


Then edit the Summary Information Stream of the just copied blastermaster_v2.msi an change the PackageCode.


Next change the ProductCode in the Property table as shown below.

Column
 Value
 Property
 ProductCode
 Value
 <new GUID>

The new version of your package shall have the version 2.0, therefore increment the ProductVersion in the Property table as follows:

Column
 Value
 Property
 ProductVersion
 Value
 2.0.0

Now remove the feature Feature_BlasterMasterService from the Feature table.


Then switch to the Component table and remove the component Comp_File_BMService.exe.


Once this is done update the Sequence column in the File table in order to take into account the removed record in this table.


Then go to the Media table and change the value LastSequence column to "21" in order to take the removed File record into account.


Finally right-click the Cabinet column and click on "Rebuild selected CABs".


Then add the following new record to the Upgrade table.

Column
 Value
 UpgradeCode
 <UpgradeCode of blastermaster.msi>
 VersionMin
 <null>
 VersionMax
 2.0.0
 Language
 <null>
 Attributes
 0x00000001
 Remove
 <null>
 ActionProperty
 UPGRADEACTIONPROPERTY

Then add the SecureCustomProperties property to the Property table as shown below:

Column
 Value
 Property
 SecureCustomProperties
 Value
 UPGRADEACTIONPROPERTY

Excercise 7.2: Minor Upgrade


In this exercise you will create a minor upgrade of your blastermaster.msi package.


First create a copy the existing blastermaster_v2.msi (from the previous exercise) and copy it to a different folder.


Then edit the Summary Information Stream of the just copied blastermaster_v2.msi an change the PackageCode.


Then change the ProductVersion property in the Property table as follows:
Column
 value
 Property
 ProductVersion
 Value
 2.0.1

Now create a new plain text file named newfile.txt and add it to your package.


Thus, add the following new record to the File table.

Column
 value
 File
 File_newfile.txt
 Component_
 Comp_File_newfile.txt
 FileName
 newfile.txt
 FileSize
 0
 Version
 <null>
 Language
 <null>
 Attributes
 <null>
 Sequence
 22

Next add the following record to the Component table.

Column
 value
 Component
 Comp_File_newfile.txt
 ComponentId
 <new GUID>
 Directory_
 TARGETDIR
 Attributes
 0x0000
 Condition
 <null>
 KeyPath
 <null>

Then add the following record to the FeatureComponents table.

Column
 value
 Feature_
 Feature_BlasterMaster
 Component_
 Comp_File_newfile.txt

Now change the LastSequence column of the Media table to "22" to take the new file into account.


Then edit the file "high scores.txt" and make a small change there (e.g. by changing a number for one of the high scores) and rebuild the Cabinet in the Media table again in order to stream the new file and the changed file into your package.


For performing the minor update run the following command in a CMD:

msiexec /i blastermaster_v2.msi REINSTALL=ALL REINSTALLMODE=vomus


Excercise 7.3: MSPs


In this exercise you will create a patch file (MSP) for your blastermaster.msi package.


Create a copy of the blastermaster_v2.msi from the exercise above and rename it to  blastermaster_v201.msi.


Now change the PackageCode in the Summary Information Stream of the blastermaster_v201.msi package.


Now change the ProductVersion property in the Property table of the blastermaster_v201.msi package as shown below.

(The ProductVersion of the blastermaster_v2.msi must stay "2.0.0".)

Column
 Value
 Property
 ProductVersion
 Value
 2.0.1

Then add the file newfile.txt and the changed file high scores.txt (just as done in the previous example) to the blastermaster_v201.msi.


Now create an administrative install image for the original version run the following command in a CMD:

msiexec /a blastermaster_v2.msi /qn TARGETDIR="<Destination Folder>"

(e.g.  msiexec /a blastermaster_v2.msi /qn TARGETDIR="C:\Easy-MSI-Book\Patches_MSPs\administrative_v2")


Next create an administrative install image for the updated version (containing the changes) run the following command in a CMD:

msiexec /a blastermaster_v201.msi /qn TARGETDIR="<Destination Folder>"

(e.g.  msiexec /a blastermaster_v201.msi /qn TARGETDIR="C:\Easy-MSI-Book\Patches_MSPs\administrative_v201")


Now you have to create a .pcp file for the patch. A blank .pcp file named template.pcp is also provided with the SDK under the path: 

C:\Program Files\Windows Installer 4.5 SDK\PATCHING


Copy the blank .pcp file template.pcp to your project folder and edit it with InstEd.


Next change the following property of the PatchMetadata table in the template.pcp file.

Column
 value
 Company
 <null>
 Property
 DisplayName
 Value
 Blaster Master 2.0.1 Patch

Then set the following properties into the Properties table of your .pcp file:

name
 value
 AllowProductCodeMismatches
 0
 AllowProductVersionMajorMismatches
 0
 DontRemoveTempFolderWhenFinished
 1
 IncludeWholeFilesOnly
 0
 ListOfTargetProductCodes
 *
 PatchGUID
 <new GUID>
 PatchOutputPath
 c:\output.msp
SEQUENCE_DATA_GENERATION_DISABLED
 1

Next add the information about the target image to the TargetImages table of your .pcp file:

Column
 value
 Target
 Target_BM
 MsiPath
 C:\Easy-MSI-Book\Patches_MSPs\administrative_v2\blastermaster_v2.msi
 SymbolPaths
 <null>
 Upgraded
 Upgraded_BM
 Order
 1
 ProductValidateFlags
 0x00000922
 IgnoreMissingSrcFiles
 0

Next add the information about the target image to the UgradedImages table of your .pcp file:

Column
 Value
 Upgraded
 Upgraded_BM
 MsiPath
 C:\Easy-MSI-Book\Patches_MSPs\administrative_v201\blastermaster_v201.msi
 PatchMsiPath
 <null>
 SymbolPaths
 <null>
 Family
 FamPatch

Next add the information about the target image to the ImageFamilies table of your .pcp file:

Column
 Value
 Family
 FamPatch
 MediaSrcPropName
 <null>
 MediaDiskId
 <null>
 FileSequenceStart
 <null>
 DiskPrompt
 Insert the Patch CD
 VolumeLabel
 PatchCD

Now once you created the .pcp file you can finally use the utility msimsp.exe which you can find in the Windows Installer SDK for generating the patch file. 

To do so run the following command in a CMD:


msimsp -s <path_to_pcp>\template.pcp -p <path_to_msp>\blastermaster_v201.msp - l <path_to_log>\mylog.txt


To apply the patch (the .msp file) to the installed product (the blastermaster_v2.msi of your first administrative installation) run the following command in a CMD:

msiexec /p blastermaster_v201.msp REINSTALL=ALL REINSTALLMODE=omus


Excercise 7.4: Small Update


In this exercise you will create a "small update" patch file (MSP) for your blastermaster.msi package.


Do just the same as in the exercise above (MSP) but leave the ProductVersion in the Property table of the blastermaster_v201.msi the same as in the blastermaster_v2.msi.
Column
 Value
 Property
 ProductVersion
 Value
 2.0.0

Finally rebuild the MSP as described in the example above and apply it.