UPGRADINGPRODUCTCODE not being set - Advanced Installer Community
adamdc78
Posts: 76
Joined: Wed Mar 19, 2014 7:42 pm

UPGRADINGPRODUCTCODE not being set

I'm trying to run a custom action based on the following conditions:

Execution Stage Condition: Regular Uninstall
Condition: UILevel = 3 OR UILevel = 4 AND InstallMode = "Remove" And REMOVE="ALL" AND NOT UPGRADINGPRODUCTCODE

My problem is that UPGRADINGPRODUCTCODE isn't getting set by the newer version. I've tried placing the custom action between InstallValidate and RemoveExistingProdcuts, after RemoveExistingProducts, after ProcessComponents and before MsiUnpublishAssemblies. I've tried Immediately and I've tried deferred.

Regardless of where and when I place the custom action, it runs and UPGRADINGPRODCUTCODE is blank.

I've attached an .aip illustrating my issues. I've also noticed that InstallMode is always "Typical" (never remove) regardless of how I try to uninstall my application (upgrade, control panel or re-running the MSI) (edit)yet the custom action still runs (shouldn't run unless InstallMode is "Remove")(/edit). I'm clearly missing something here.

Thank you,

Adam Cohen
Attachments
setup.aip
Minimal example.
(12.1 KiB) Downloaded 450 times
Last edited by adamdc78 on Wed Feb 11, 2015 2:44 am, edited 1 time in total.
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: UPGRADINGPRODUCTCODE not being set

Hi Adam,

A major upgrade is essentially the removal of an older product which is replaced by a newer product. The upgrade process performs the following actions:
  • Detect and completely remove older products.
  • Install the new product.
Please note that the UPGRADINGPRODUCTCODE property is set in the MSI which is being upgraded if the package is uninstalled by a newer version. So, this property is set only in the old version of your package which is already installed on the target machine when the upgrade process occurs (in the package with the lower version).

The OLDPRODUCTS property is set in the upgrading MSI if the package found an older version installed on the target machine. So, this property is set in the package that is currently launched for installation, only if an old version is installed on the target machine and the upgrade process occurs (in the package with the higher version).

For details, please check the How do I determine if an Upgrade is being performed? article which may be useful to you.

Let us know if that helped.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
adamdc78
Posts: 76
Joined: Wed Mar 19, 2014 7:42 pm

Re: UPGRADINGPRODUCTCODE not being set

The custom action is only happening on uninstall (and should only be happening when not upgrading, which is the part I can't get to work), so OLDPRODUCTS will always have a value. UPGRADINGPRODUCTCODE never has a value whether I keep or change the product code when updating the version number (the popup asking whether it's a major upgrade or patch).
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: UPGRADINGPRODUCTCODE not being set

Hi Adam,

As I said, the UPGRADINGPRODUCTCODE property is set in the MSI which is being upgraded, the one that is already installed and it is only set if the uninstall is perform by a newer version(during an upgrade).

The OLDPRODUCTS property is set in the upgraded MSI if the package found an older version installed on the target machine. This property is set in the package that is currently launched for installation, only if an old version is installed on the target machine and the upgrade process occurs (this property is set in the package with the higher version).

As I can see, the current version of the attached project is 1.0.8. The UPGRADINGPRODUCTCODE property will be set in this package when you will run a package with a higher version (e.g. 1.0.9).
In the package with the higher version than the currently installed one, the OLDPRODUCTS property will be set instead.

Both properties will be set during an upgrade process.
So, the UPGRADINGPRODUCTCODE property is set in the installed package while the OLDPRODUCTS property is set in the package that is currently launched for installation.

If you have other questions, please let us know.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
adamdc78
Posts: 76
Joined: Wed Mar 19, 2014 7:42 pm

Re: UPGRADINGPRODUCTCODE not being set

I've been doing upgrades from 1.0.0 to 1.0.8 and have yet to see UPGRADINGPRODUCTCODE set when I uninstall from the newer MSI (I'm passing it as action data to my custom action and it always comes up as empty string); it seems as though it is in fact getting set, but isn't accessible in this manner (once I fix the root cause of the problem, the condition fails so it must be getting set, even though I can't output it in my custom action).

The root of my problem was a lack of parentheses around my OR condition (UILevel=3 was always true and everything after the or was getting ignored).

Thank you once again,

- Adam
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: UPGRADINGPRODUCTCODE not being set

You're welcome Adam,

I'm glad you got this working.
If there is anything else I can help you with, please let me know.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”