We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

Robert Kock
Posts: 4
Joined: Fri Dec 22, 2023 1:00 pm

Uninstall: distinguish regular from upgrade

Within the 'Upgrades' page of my project I set the order to "Uninstall old version first and then install new version".

I have a custom action that runs only when uninstalling but its actions depend on whether we're dealing with a "regular uninstall" or "replaced by a new version".
I could of course create 2 different custom actions: The first one runs only during a regular uninstall and the second one only during an uninstall of an old version being replaced by a new one. This however would create partial duplication of code that makes the maintenance more complicated.

My question is: is there a property whose value I can read within the custom action in order to be able to distinguish the mode of the uninstall?

FYI: My custom action runs AFTER the "Finish Execution" step within the "Install Execution Stage"
Catalin
Posts: 7853
Joined: Wed Jun 13, 2018 7:49 am

Re: Uninstall: distinguish regular from upgrade

Hello Robert,

In order to achieve this, you could use the OLDPRODUCTS property which is set only during a major upgrade.

We can use the following logic:

- if the property exists, it means it's an upgrade

- if it doesn't, it means it's a regular uninstall

Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Robert Kock
Posts: 4
Joined: Fri Dec 22, 2023 1:00 pm

Re: Uninstall: distinguish regular from upgrade

Hi Catalin,

The property OLDPRODUCTS appears absent both during a regular uninstall and upgrade.
However, I did the trick you suggested checking the UPGRADINGPRODUCTCODE property.
Things work as they should now.

Thanks,
Robert
Catalin
Posts: 7853
Joined: Wed Jun 13, 2018 7:49 am

Re: Uninstall: distinguish regular from upgrade

You are always welcome, Robert!

Glad to hear everything is working as expected now.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”