Programatically recognizing an upgrade
Updated: 23 May 2010 | 5 comments
Is there a way for a custom action DLL in a merge module to determine whether an install is an upgrade? I haven't found a way, but maybe someone has a solution which will work for a merge module.
A package that's being uninstalled can check UPGRADINGPRODUCTCODE to find out if it's being removed during an upgrade, and that can be used in a merge module by virtue of being a known property. Unfortunately a merge module doesn't know the names of ActionProperties defined in the MSI's Upgrade table.
discussion Filed Under:
Comments
What are you trying to achieve?
What are you trying to achieve with this?
Accoring to Conditioning Actions to Run During Removal it should be possible
To determine whether a product is being removed by an upgrade, check the UPGRADINGPRODUCTCODE property. The installer only sets this property when RemoveExistingProducts removes the product. The installer does not set the property during a normal uninstall, such as removal with Add/Remove programs.
hmm
the entry Kim posted appears to only be available from Windows installer 4.0 and later. If your under that
perhaps you could use session.database to trawl the entries in the upgrade table.
take the properties from the right hand column, then evaluate the properties to see if they contain a product code. if they do then you have an upgrade which is about to happen. My guess is UPGRADINGPRODUCTCODE is doing something similar.
UPGRADINGPRODUCTCODE
From the SDK:
Windows Installer
UPGRADINGPRODUCTCODE Property
The UPGRADINGPRODUCTCODE property is set by Windows Installer when an upgrade removes an application. The installer sets this property when it runs the RemoveExistingProducts action. This property is not set by removing an application using the Add or Remove Programs in Control Panel. An application determines whether it is being removed by an upgrade or the Add or Remove Programs by checking UPGRADINGPRODUCTCODE.
Available with Windows Installer version 1.1 or later.
John,
Not entirely sure whether this is what you are referring to when you say this is only available from Windows Installer 4.0, but the SDK would seem to indicate that the UPGRADINGPRODUCTCODE property has been available since Windows Installer 1.1
If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.
The Windows Installer
The Windows Installer "references" at MSDN seems to be referring to 4.0 and up for the most supported versions.
Not the first example...
That won't be the first example of "current versions only" BS on the Microsoft website.
If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.
Would you like to reply?
Login or Register to post your comment.