szanto90balazs
Posts: 2
Joined: Mon May 14, 2018 9:26 am

How do I remove older versions of a side by side installed application?

Hello,

As I want use the Google Omaha framework for silent automatically updates, I have to create an installer which support side by side installation with the following folder structure.

installdir
\app-1.0.0.0
\... files
\app-1.1.0.0
\... files
\app-launcher.exe

One of the scenarios I have to implement is the following:
1. the application v1.0.0.0 is running
2. Google Omaha downloads v1.1.0.0 and silently installs the MSI side by side (I managed to do this part)
3. At some point in time the, when the app is not running, v1.0.0.0 has to be removed, however this removal logic has to be implemented somehow by the installer.

Can you give me some advice how is it possible to achieve this by using Advanced Installer?

I'm also wondering how can I achieve that the registry values are only deleted when the last installed application is deleted from the machine. So for example when 1.0.0.0 get uninstalled I don't want my registry entries get deleted.

Thank you,
Balazs
Eusebiu
Posts: 4931
Joined: Wed Nov 14, 2012 2:04 pm

Re: How do I remove older versions of a side by side installed application?

Hi Balazs and welcome to our forums.

Thank you for your interest in Advanced Installer.

In order to create more versions of a product that can be installed side by side with Advanced Installer, you can go in the "Upgrades" page and select the "Allow side by side installs of different product versions" option.

Also, go in the "Dialogs" page and add the "UpgradeDlg" predefined dialog then, in the "Custom Actions" page, add a "Set installer property" custom action after the "Install Execution Stage -> Searches" action group to set the "side by side" option as default on a silent install. It should be configured as follows:
  • Property: AI_UPGRADE
    Value: No
    Condition: UILevel = 2
The problem is that a Windows Installer package can uninstall another version only when the new one is installed, but later (e.g. when the app is not running) this is not possible. To achieve this, you can use the "Scheduled Tasks" support to add a scheduled task that uninstall the old version later (e.g. at login).

In order for the registry entries to be deleted only when the last installed application is removed, you need to make sure that the GUID numbers of the components related to those registry entries are the same in all the versions of the product.

By the way, if you want to upgrade the product even if the old app is running (uninstall the old version and install the new one) you can use the "Terminate process" predefined custom action to stop that application before the upgrade.

Let me know if this helped, otherwise give me more details about your scenario.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
szanto90balazs
Posts: 2
Joined: Mon May 14, 2018 9:26 am

Re: How do I remove older versions of a side by side installed application?

Hi Eusebiu,

Thanks for getting back.

I was able to pull it off, however I needed some tweaks:

Side by side installations:
I turned side by side installation OFF, because every time a version number is incremented, the component GUIDS are regenerated for every component. This caused some troubles like registry entries got deleted when I uninstalled the previous versions. So eventually I turned it off.

I created my way of side by side installation by either
- put RemoveExistingProduct behind a condition that it shouldn't run when the older versions of a application running
OR
- manipulated the OLDPRODUCTS property from a C# custom action as I removed every product id from the property which belongs to a running application

I also made the RemoveExistingProduct the last step of the installer.

I also had to turn off the "Override Windows Installer programs list entry", because it was buggy. When I had lets say 1.0.0.0 and 1.1.0.0 installed and I uninstalled 1.0.0.0, an entry in the Programs and Features was still there even though everything else was properly removed. I also checked the Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall registry entries and I can confirm that app had two registration entries and only one of them were deleted. When I uninstalled the 1.1.0.0, it went well.

Cheers
Balazs
Eusebiu
Posts: 4931
Joined: Wed Nov 14, 2012 2:04 pm

Re: How do I remove older versions of a side by side installed application?

You're welcome Balazs. I'm glad you got this working.

Thank you for all the details you shared with us. I'm sure they will help other users in the future.

Let us know anytime you need assistance.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”