Warrigal
Posts: 43
Joined: Thu Jun 26, 2008 8:20 am

How to detect if feature installed in earlier version

When doing an upgrade, I need to detect whether a feature has been installed from an earlier version.

When doing an installation, you can detect whether the same product (i.e. same ProductCode) is already installed by using the Installed property, but how do you detect whether an earlier version has been installed (i.e. same UpgradeCode, but different ProductCode and earlier version number)?

Once you've detected whether an earlier version is installed, how do you detect if a feature has been installed from that version? I can't just check for the presence of files, because the files may have been copied manually, rather than being installed by the installer.
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: How to detect if feature installed in earlier version

Hello,

- On the Upgrades page in Advanced Installer, create a new entry in the Upgrades table.
- Select the package whose features you want to detect/upgrade.
- On the Upgrade Action tab, write the Feature IDs of the features you want your package to upgrade from the package you specified on the previous step.

If upgrading only certain features from another product is not what you want, you can try directly using the Windows Installer API: MsiQueryFeatureState to get the state of a feature.

Let me know if this helped.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
Warrigal
Posts: 43
Joined: Thu Jun 26, 2008 8:20 am

Re: How to detect if feature installed in earlier version

Brilliant. Specifying the features in the Upgrade table does exactly what I wanted to do and this approach is much simpler than I thought it would be. (I didn't even realise that you could do this.) The only problem now is working back through all our old installers (all done in InstallShield) to work out the old feature names for the old versions of our software.

This technique leaves two entries in the Add or Remove Programs window and two Start menu shortcuts (which we use to change, repair or remove the installed applications), so I just need to make sure that they have unique names. No problems.

Thanks for the help. I was tearing my hair out over this yesterday.

Return to “Common Problems”