Automatic uninstallation of previous version

Request new features that you would like to see in the next version of Advanced Installer.
Nullable
Posts: 4
Joined: Sat Oct 07, 2017 8:44 am

Automatic uninstallation of previous version

Postby Nullable » Sat Oct 07, 2017 9:08 am

Hello,

I’m new to AI so please don’t give me too much of a hard time if I’m way wrong here :D

I would like to have AI automatically remove the previous instance of my application, regardless of its version.
(By simply detect the product id and run msiexec to remove it)

This would avoid having to see the ”Please remove the application from the control panel” dialog, which isn’t very user friendly.
It also lets the user up- and downgrade any application, as long as the product id stays intact.

Edit: One could obviously argue that it would make it hard to invoke the maintenance dialog (modify/repair/remove) if the application is automatically removed.
But another vendor has solved this by using an Instance id, along with the Product id.
The Instance id is regenerated each time the installer is compiled and the installer maintenance dialog is only invoked when both Product and Instance id are the same.

So when the Product id is the same and not the Instance id, the previous version of the application is removed as a first step when running the installer.

Best regards
Nullable

Sorin
Posts: 584
Joined: Mon May 08, 2017 1:03 pm

Re: Automatic uninstallation of previous version

Postby Sorin » Tue Oct 10, 2017 2:50 pm

Hello,

Have you received the error message from the attached screensot?

This dialog can only occur on development machines.You needn't consider preventing it on clients machines. Please take a look on this F.A.Q. regarding this subject: Why do I receive the "Another version of this product is already installed" message?

Your scenario could be implemented using major upgrades Windows Installer feature : Windows Installer Upgrades

Also, for enabling the downgrades you have to implement custom upgrade rules. The default Windows Installer behavior when you try to install an older version of an installed package is to prompt the user and to interrupt the installation.

This is the complete implementation:

1. Go to the "Upgrades" page and select "Customize Advanced Installer upgrade rules". Two rules will be displayed in the "Upgrades" section.
- double click on the first rule and modify it in the following way: in the "Versions o upgrade" field, Min version enter "1.0.0" and in the max version enter a large value that your package will never exceed, for example 100.100.100"
- double click on the second rule and modify it in the following way: in the "Versions o upgrade" field, Min version enter "100.100.100". The "Max version" field should be left empty
2. Create a backup copy of you .AIP file - this will be the old version
3. Edit the project as you wish in order to configure the new version.
4. Go to "Product Details" page and increment the "Product Version". When leaving the page you will be prompted if you want to generate a new Product Code. You have to select "Generate New"
5. Build the project

In this way when one of the versions is installed and the setup of the other one is launched, it will first uninstall the other version and then install the version of the launched package - this could be either an upgrade or a downgrade. Also, if the same version of the package is installed launching the package will trigger the maintenance mode.

Best regards,
Sorin
Attachments
error.jpg
error.jpg (34.29 KiB) Viewed 200 times
Sorin Stefan - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Nullable
Posts: 4
Joined: Sat Oct 07, 2017 8:44 am

Re: Automatic uninstallation of previous version

Postby Nullable » Tue Oct 10, 2017 3:56 pm

Yep, that's the one!

Thanks a lot for your suggestions. By changing the product code the previous version was silently removed, perfect!
Now I just need to figure out how to preserve the options from the previous installation. (The selected features and such...) :D

Sorin
Posts: 584
Joined: Mon May 08, 2017 1:03 pm

Re: Automatic uninstallation of previous version

Postby Sorin » Fri Oct 13, 2017 1:35 pm

Hello,

Now I just need to figure out how to preserve the options from the previous installation. (The selected features and such...)


This could be implemented using some registry values that store the information. These should be added in the old installation. The new installation could access this information through some Searches.

Please give us more details regarding your desired behavior so we could recommend a more detailes solution.

Best regards,
Sorin
Sorin Stefan - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Nullable
Posts: 4
Joined: Sat Oct 07, 2017 8:44 am

Re: Automatic uninstallation of previous version

Postby Nullable » Wed Dec 06, 2017 10:03 am

Hello,
When an application gets installed I pretty much want the following;
1 - Detect the presence of a previous installed application
2 - (Silently) uninstall the existing instance -regardless of its version-
3 - Install the new version, preserving the path and other options of the just uninstalled app. The upgrade dialogs will have the previous installation options and settings as default.

The whole purpose is for a tech guy to comfortably upgrade a customer application, preserving paths and database connection properties and other settings. Often the upgrade is performed by another guy than the one installing the previous version and by preserving the settings an upgrade is very easy to perform, just next - next - next - finish - done - grab a coffee.

As it is now the guy performing the upgrade needs to figure out all these settings before performing the upgrade, with a big chance/risk of bad config.

/N

Sorin
Posts: 584
Joined: Mon May 08, 2017 1:03 pm

Re: Automatic uninstallation of previous version

Postby Sorin » Wed Dec 06, 2017 3:11 pm

Hello,

I would recommend the following implementation for your scenario :

For point 1 and point 2 you could implement the major upgrade machanism : Windows Installer Upgrades. In order to crate an upgrade project, just increment the product version from "Product Details" page. When leaving "Product Details" page you will be prompted if you want to generate a new Product Code. You have to select "Generate New". Also, before creating the upgrade code please make sure you save a backup copy of the old project.

Regarding the third point, you could "Use original installation path when upgrading" option from "Upgrades page". The state of the installed features is automatically migrated to the upgraded package.

In order to preserve the custom user settings at upgrade time (edit boxes, checkboxes, etc.), you have to set the properties associated with these controls as persistent : Edit Property Dialog. Just go to "Install Parameters" page and click "Show properties with empty value or used in dialogs controls", double click on the property in question and enable "Set persistent property". Please note that you have to enter a default value for a property in order to be able to make it persistent.

Best regards,
Sorin
Sorin Stefan - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Nullable
Posts: 4
Joined: Sat Oct 07, 2017 8:44 am

Re: Automatic uninstallation of previous version

Postby Nullable » Fri Dec 08, 2017 9:09 am

Thanks a lot for your fast reply, greatly appreciated :)

Sorin
Posts: 584
Joined: Mon May 08, 2017 1:03 pm

Re: Automatic uninstallation of previous version

Postby Sorin » Fri Dec 08, 2017 9:50 am

Hello,

You are welcome.

Don't hesitate to contact me if you have any other questions or doubts.

Best regards,
Sorin
Sorin Stefan - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube


Return to “Feature Requests”

Who is online

Users browsing this forum: No registered users and 0 guests