Video Screencast Help
Search Video Help Close Back
to help
New in the Rewards Catalog: Vouchers for "Symantec Technical Specialist" and "Symantec Certified Specialist" exams.

Programatically recognizing an upgrade

Updated: 23 May 2010 | 5 comments
Alan Sinclair 2's picture
0 0 Votes
Login to vote

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

AngelD's picture
19
Apr
2009
0 Votes 0
Login to vote

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.

John McFadyen's picture
19
Apr
2009
0 Votes 0
Login to vote

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.

EdT's picture
21
Apr
2009
0 Votes 0
Login to vote

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.

AngelD's picture
21
Apr
2009
0 Votes 0
Login to vote

The Windows Installer

The Windows Installer "references" at MSDN seems to be referring to 4.0 and up for the most supported versions.

EdT's picture
22
Apr
2009
0 Votes 0
Login to vote

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.