Prerequisite Install Conditions - Advanced Installer Community
germ
Posts: 3
Joined: Thu Jun 18, 2015 7:59 am

Prerequisite Install Conditions

I have a situation which seems like it should be fairly common, but I'm having trouble finding the best way to do it.

I have two installers, both of which are major upgrades.

The first upgrades my main product, the second upgrades an optional add-on to the main product.

I would like to distribute the main upgrade, and conditionally download and run the add-on upgrade if it's needed. The add-on upgrade should only run if an earlier version of the add-on has already been installed, but not if the current version of the add-on has been installed.

My first thought was to add the add-on as a prerequisite, but if I do that, how would I add install conditions to: a) check that an earlier version has already been installed; and b) ensure it doesn't try to install if it has already been installed. Previous versions of the add-on installer didn't add registry keys / values, so I can't use these criteria.

If this isn't the best way to do it, what would be an alternative way to achieve the same result?
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Prerequisite Install Conditions

Hello and welcome to Advanced Installer forums,
a) check that an earlier version has already been installed;
In order to check if an earlier version was installed, you can use the Product Version (identify by Product Code) search criteria. For details, please take a look on the Edit Prerequisite Search Dialog article. Also, you should take a look on the Product Identification (ProductCode and UpgradeCode) article which may be useful to you.
b) ensure it doesn't try to install if it has already been installed.
You can use the same install condition as above to see if the current version of the add-on is already installed or you can use a registry key criteria search.

It seems that in your detection criteria, at least the first criteria must be true in order to install the prerequisite (the Product Version (identify by Product Code) search criteria). However, in the Install Conditions you can only choose between:
  • Install only if at least one condition is false
  • Install only if at least one condition is false


It seems that you cannot define the install conditions according to your needs. In this case, you can select the Always install the prerequisite option and condition its feature installation. Please note that each prerequisite that is added as a Feature-Based or Post-Install prerequisite creates its own feature in the Organization page.

First of all, you need to create the search operation in the Search page. To check if an earlier version was installed you can use the Product Version (identify by Product Code) search from the Extended Search Properties.
If a search operation will be successfully (e.g. the related product code is registered on the target machine), the property assigned to the search operation will be set, otherwise the property will be empty.

You can use the same install condition as above to see if the current version of the add-on is already installed or you can use a registry key criteria search.

After creating the two search operation, you can go in the Organization page and click on the Add Install-time Conditions option from the Installation behaviour section of the feature properties.

Select the Not Installed behavior and add in the Installed if field your properties depending the criteria you have used. e.g. if you will use the ProductCode as criteria search, you should have something like that:

Code: Select all

PRODUCTCODE_OLD_VERSION AND (NOT PRODUCTCODE_NEW_VERSION)
where
  • PRODUCTCODE_OLD_VERSION is the property assigned to the search operation to check if an earlier version is installed;
  • PRODUCTCODE_NEW_VERSION is the property assigned to the search operation to check if the current version of the add-on is already installed;
So, it should look something like this:
FeatureInstallationBehaviour.png
FeatureInstallationBehaviour.png (8.13 KiB) Viewed 3723 times
As you can see, the feature will be installed only if the earlier version will be found and if the current version of the add-on is not already installed, according to your scenario.

Should there be any difficulty you encounter implementing something, please do not hesitate to contact me and I will gladly assist.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
germ
Posts: 3
Joined: Thu Jun 18, 2015 7:59 am

Re: Prerequisite Install Conditions

Thank you, that worked perfectly. The only thing I changed was to use the Upgrade Code instead of the Product Code to check for all previous installed versions.
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Prerequisite Install Conditions

You're welcome,

Should there be any difficulty you encounter implementing something, please do not hesitate to contact me and I will gladly assist.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”