MattFielder
Posts: 22
Joined: Thu Jan 05, 2012 9:49 pm
Contact: Website

Different behavior based on version upgrading

Tue Sep 18, 2012 1:18 am

I need my installer to behave differently based on the version that it is upgrading.

The installer will encounter one of three scenarios. A first time install, upgrade against the current major version, or upgrade against previous major version.

The previous installer I wrote wasn't difficult because it was the first for the current major version, so only two possiblitiles, either a new install or an upgrade. I have a custom dialog that only shows on ugprade, but now that the upgrade can be from the current major version, the verbiage is not accurate. I need to follow different paths based on the version being upgraded. How do I do this?

I can lay out the three different scenarios if necessary, but I think the above shows what I'm looking for.

Thanks.

Daniel
Posts: 8187
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Different behavior based on version upgrading

Tue Sep 18, 2012 12:17 pm

Hello,

In order to detect if an older version of your product is already installed on target machine you should verify if the OLDPRODUCTS property is set.

In order to detect if you are performing an upgrade against the current major version or against a previous major version you can create a registry search (i.e. PREVIUOS_VERSION) which will search for your older product version. Then you can create your own custom action which will compare the first field of the product version stored in the PREVIUOS_VERSION property with the first field of the current product version (stored in the ProductVersion property) and will set another property (i.e. MYPROP) accordingly.
Here's the steps to proceed:
- Go to "Search" page and add a new registry search (PREVIUOS_VERSION), which will search for your older product version value, like this:
  • Root: HKEY_LOCAL_MACHINE
    Key: Software\[Manufacturer]\[ProductName]
    Name: Version
    Type: Retrieve the raw value
- Go to "Custom Actions" page and add your custom action after "Wizard Dialogs Stage" -> "Searches" action group.
- Build and run your project.

Let us know if this helps, otherwise please give us more details about your scenario (maybe exemplify).

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”