mheckmann
Posts: 74
Joined: Wed Apr 20, 2011 6:24 pm

uninstalling version if trying to install older version

Hello,

not sure how to describe it but I'm looking for some instructions on following requirement:

- a version of our software is installed
- the user tries to install an older version of the same software and get's the error that a newer version is already installed

how do I create a workflow were the user would receive an error but with an option to first uninstall the newer version and then the installer continues installing the older version?

Thx
Markus
Daniel
Posts: 8276
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: uninstalling version if trying to install older version

Hello Markus,

Please keep in mind that it is not recommended to use such a scenario. However, in order to achieve what you want you can proceed like this:
- Go to "Upgrades" page and check the "Customize Advanced Installer upgrades rules" option.
- In the "Upgrades" group add an additional upgrade rule using the "New..." context menu option.
- In the "Product Info" tab of the "New Upgrade" dialog set the following option:
  • Upgrade Code: [|UpgradeCode]
    Min. Version: [|ProductVersion]
- In the "Upgrade Action" tab set the "Store in" field with MY_PROP.
- Select the "AI_NEWERPRODUCTFOUND" row and use the "Edit..." context menu option. Set the "Min. Version" field, from "Product Info" tab, with a higher number (e.g. 10000).
- Go to "Dialogs" page, select the "WelcomeDlg" dialog and add a new dialog (e.g. MY_DIALOG).
- Select "MY_DIALOG" and from its context menu choose "Show only if ..." option. Set the "Expression" field, from "Edit Condition" dialog, with MY_PROP (in this way this dialog will be displayed only when a downgrade can be performed).
- Customize accordingly your new dialog (MY_DIALOG) to display a downgrade warning message.
- Build and run your project.

Let us know if this helped.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
mheckmann
Posts: 74
Joined: Wed Apr 20, 2011 6:24 pm

Re: uninstalling version if trying to install older version

Thanks for these instructions. Seems to all work very well!
One thing I tried to do is access the product version of the already installed software and thought it might be in AI_NEWERPRODUCTFOUND - is there a different property where this is stored in?

cheers
Markus
Daniel
Posts: 8276
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: uninstalling version if trying to install older version

Hello Markus,

When upgrading you can access only the product code of an already installed product which will be set in the OLDPRODUCTS property after "Searches -> FindRelatedProducts" standard action. If you are using the above workaround then the product code of an already installed product will be set in MY_PROP property.

Also, if the product version of an existing version of your application is stored in a registry value, then you can access it using a registry search.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
mheckmann
Posts: 74
Joined: Wed Apr 20, 2011 6:24 pm

Re: uninstalling version if trying to install older version

Thx Daniel, this worked perfectly.

cheers
Markus
Daniel
Posts: 8276
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: uninstalling version if trying to install older version

You're welcome. Glad to help.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
mheckmann
Posts: 74
Joined: Wed Apr 20, 2011 6:24 pm

Re: uninstalling version if trying to install older version

Hi Daniel,

I think I'm running into a problem here. Our build numbers have gone beyond 10000 and therefor I believe the upgrade check does not work correctly anymore.
Is there a way to increase the Min Version value to beyond 10000?

Thanks
Markus
Daniel
Posts: 8276
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: uninstalling version if trying to install older version

Hello Markus,

You can increase the build number of your ProductVersion up to 65535. Please keep in mind that the higher product version (ProductVersion property) which you can set for an installation package is 255.255.65535. So, you can add the 255.255.65535 version in the related "Min. Version" field.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
GregDude
Posts: 7
Joined: Thu Apr 14, 2016 3:09 am

Re: uninstalling version if trying to install older version

I have been using this method, I thought successfully, however lately the downgraded installation is missing the application .exe file and one random file from a synchronized folder.

Repairing the downgraded installation fixes the two missing files, but defeats the purpose of user choice during installation.

Any ideas how to fix this?
Daniel
Posts: 8276
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: uninstalling version if trying to install older version

Hello,

To avoid this file versioning issue when downgrading the product, you can go to "Files and Folders" page, double click on the related application file, go to "Operations" tab and enable the "Always overwrite existing file" option. This setting should be applied in all versions of your setup project.

Hope this helped.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
GregDude
Posts: 7
Joined: Thu Apr 14, 2016 3:09 am

Re: uninstalling version if trying to install older version

Thanks Daniel, that did appear to fix it.

I only flagged the application .exe to always overwrite for this test. Should I flag ALL files and folders just in case? I'm wondering if this could occur for other random files in future. Flagging all files could become a maintenance risk unless though, unless there exists is a global flag to avoid missing files in future?
Daniel
Posts: 8276
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: uninstalling version if trying to install older version

You are always welcome.

Using the "Always overwrite existing file" option for all of your project files and folders should be entirely your choice. When this option is used the file on disk will be always replaced with the file from the setup project. However you should decide if this could have downside impacts over your installed application product.

I think for the moment the best approach for you will be to use this option only for the files which you find out (within your test routines) that can be successfully installed during an upgrade/downgrade only by using this option.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”