Catalin
Posts: 6542
Joined: Wed Jun 13, 2018 7:49 am

Detect the Upgrade process during the BootstrapperUI Sequence

Fri Jun 24, 2022 12:31 pm

Hello guys,

Recently one of our customers had the following scenario:

Had an EXE setup package, with a pre-install prerequisite and the "Check for launch conditions before searching for prerequisites" option enabled under the "Prerequisites" page.

The above option is of course useful because you would not want your prerequisites to be installed and then your main setup failing due to a launch condition.

Now, of course, on top of all that, the customer wanted to have a launch condition that would imply the detection of the upgrade process.

Normally, this would have been done through the OLDPRODUCTS property, which is specifically set during an upgrade.
A list with the Product Codes of the older versions of your installation package. This property is set only in a package which upgrades another package.
Now, of course, he used this property as a condition and it invalidated the whole launch condition. Basically, when the launch condition should have been triggered, it wasn't.

Upon further investigations, I realized that what happened is normal. The OLDPRODUCTS property is only set when the MSI is launched.

Now, our EXE bootstrapper is simply a wrapper over the MSI, which also displays a UI. For instance, the "PrerequisitesDlg" that lets the user decide which prerequisite he/she wants to be installed is rendered by our EXE bootstrapper (pre-install prerequisites can only be handled by our EXE bootstrapper).

Now, since the launch condition was checked before the prerequisites, it obviously was checked during the EXE Bootstrapper UI - which we call the "BootstrapperUI Sequence".

The problem here, of course, was that the OLDPRODUCTS did not exist, because the MSI was not yet launched into execution.

A solution to avoid this would be the following:

- in the "Search" page, add the "ProductVersion (identified by UpgradeCode)" Extended Search

The above search will identify if a previous version is already installed, by the UpgradeCode and it will return its ProductVersion.

If the above turns out to be true, it means we have an upgrade scenario on our hands.

You can then use the property used to store the result of the search in your "Launch Condition", instead of the OLDPRODUCTS property.

Hope you will find this useful!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Sample Projects”