Wednesday, May 5, 2010

Check if related product is already installed

If your application depends on some another basic application, you need to check if the basic application is already installed. You can use the FindRelatedProducts action.
Use the following steps:
1) Define the UpgradeCode of the basic product:
<UpgradeVersion OnlyDetect="yes" Minimum="" IncludeMinimum='no' Property="BASICINSTALLED" />
2) Specify a Custom Action performed if the basic product is not installed:
<CustomAction Id='NotBasic' Error='The basic product should be installed on the server.' />

3) Schedule the custom action execution
<Custom Action='NotBasic' After='FindRelatedProducts'>NOT BASICINSTALLED</Custom>

During installation, Windows Installer define a Product Code for the specified Upgrade Code and assign it to the BASICINSTALLED property. If there is no products installed with the Upgarde Code, the property is not defined. In this case the Custom Action will be performed and installation completes.

Note: The property assignment will be skipped if the basic appliaction is installed on per-machine mode but your application is installing in per-user mode.
The following log is written:
FindRelatedProducts: current install is per-user. Related install for product '{Product_Code_GUID}' is per-machine. Skipping...

No comments:

Post a Comment