How do I create a patch that runs a custom action?AnswerSometimes a patch must perform some actions which are not supported
by Windows Installer. In this case, the best solution is to use a
custom action which has the execution condition set to
PATCH. Create the target packageA patch is basically the
difference between the target and upgraded packages. Therefore, the
first step in creating a patch is obtaining the target package. This can
be done by creating and
configuring a new project. The custom action which runs during the patch should not be included
in the target package. However, if there is no other solution, the patch
will allow the custom action in the target package.
Create the upgraded packageThis can be done by
following these steps: - backup the AIP of the target package
- open it in Advanced Installer
- go to the Product Details
page and increase the version
- after you select another page you are prompted about changing the
Product Code
- in this dialog select No because the target and
upgraded packages must have the same product code
- update the project (add/remove/modify files, registry keys etc.)
- go to the Custom Actions
page and create your custom action
- in the Execution Condition section of the Custom Action Properties
page set the Expression field to
PATCH
- save and build the project (the target and upgraded packages must
have the same name, for example: "test.msi")
When increasing the version of the project, make sure you do not
modify the first field of the version. Otherwise, the patch creation
process will fail.
Create the patchA patch can be created by using a
"Patch" project: - open Advanced Installer and in the "New Project" dialog select
Patch
- save the project
- after configuring the patch information, go to the Images page
- create the target and upgraded images by using the target and
upgraded packages
- build the project
Since the custom action is included in the Upgraded package and it
has the condition PATCH, it is automatically
included in the patch. Also, its condition will tell Windows Installer
to run it when the patch is applied. |