Intellection Pty Ltd
Posts: 6
Joined: Fri Oct 12, 2007 12:47 am

Force Upgrade to install to a new folder

I am hoping somebody might be able to help me with this. I am strugging with my Advanced Installer project, trying to get it to ignore the application folder of the previous version of my application, and force it to install into a new folder. However, no matter what I do it insists on defaulting to install in the previous version's folder. Is there any way to prevent this, short of ignoring the [APPDIR] altogether and hard-coding the installation folder path?

To elaborate:
* The previous version of my product installed to [ProgramFilesFolder][Manufacturer]\[ProductName]\, and lets say it was called 'product 2.0'
* The new version is called 'product 2.1' and I want it to remove 2.0, but install itself into [ProgramFilesFolder][Manufacturer]\product 2.1\

I have tried:
* Just changing the Product Name
* replacing [ProductName] in the application folder path with a hard-coded 'product 2.1'
* changing the application path to [ProgramFilesFolder][Manufacturer]\ and hard-coding a 'product 2.1' folder in the 'files and folders'

but no matter what I do, I can't seem to get around the logic that picks up the previous version's install folder as a default.

I can't let the users install into that folder, because there are certain configuration files left behind by the uninstall that are incompatible and would cause the new version to crash. I don't want to remove those files, because I want the user to have the option of rolling back to the old version, and retaining that configuration information. I don't want to go the 'side by side install' route, because that will just lead to confusion and users running the wrong version.

So, any suggestions?

Thanks!

P.S. I tried searching for previous posts on this topic, but all the relevant keywords like "upgrade", "install" and "location" get rejected as being too common; so my apologies if this has been answered previously!
Cristi
Posts: 34
Joined: Wed Oct 08, 2008 8:44 am
Contact: Website

Re: Force Upgrade to install to a new folder

Hi,

I recommend using PseudoFormatted Type properties for identifying the versions. For example, in the Product Details page you can set "Product Name" like this:

Code: Select all

Product[|ProductVersion] 
Also, in the "Application Shortcut Folder" of the Files and Folders page you can make shortcuts like this:

Code: Select all

Shortcut to Product[|ProductVersion] 
This way you can use the "Allow side by side installs of different product versions" option from the Upgrades page without risking to confuse the users (The versions will be installed in separate folders and will have different shortcuts).

If you don't want to use the "Allow side by side installs of different product versions" option you can try the following approach:

- set the "Product Name" and create the shortcuts as described above
- you can create a Property Set with Formatted Custom Action in the InstallExecuteSequence in your upgrade package. Please note that the custom action can be scheduled only after the CostFinalize action. In the custom action you can set the "Property Name" to AI_UPGRADE and "Formatted Text" to Yes.

In this case any upgrade package will be installed in a separate folder and will have separate shortcuts according to its version, but the older versions will be removed.

I recommend using the "Search" available at Advanced Installer site because it provides more search results.


Best regards,
Cristi
______________________________
Cristi Costache
Advanced Installer Team
http://www.advancedinstaller.com/
Intellection Pty Ltd
Posts: 6
Joined: Fri Oct 12, 2007 12:47 am

Re: Force Upgrade to install to a new folder

Thank you very much for the response. The suggestion regarding the custom action looks promising; I'll give it a go. The multiple icons approach would leave me still with a risk of users starting the wrong version (they don't pay attention to niggling details like version numbers on shortcuts - we're talking about very non-technical users here), so I'd prefer not to go that route.

Mnay thanks!
Intellection Pty Ltd
Posts: 6
Joined: Fri Oct 12, 2007 12:47 am

Re: Force Upgrade to install to a new folder

OK, I tried setting AI_UPGRADE to "Yes" as a custom action in the RemoveExistingProducts standard action, but it did not appear to have any effect. I also tried setting the same property in the CostFinalize action of the InstallUISequence, and in the UIStarting action of the InstallUISequence. Neither of those had any effect either - it still defaults to installing into the previous versions folder.

I think an option might be to set it up as a side-by-side install, but set up some custom action or upgrade rule to stil uninstall the previous version. I'll investigate that and see what can be done.
Cristi
Posts: 34
Joined: Wed Oct 08, 2008 8:44 am
Contact: Website

Re: Force Upgrade to install to a new folder

Hi,

Please note that the custom action should be scheduled under "InstallExecuteSequence", not under "InstallUISequence". You can show the "InstallExecuteSequence" -> "CostFinalize" standard action by using the "Show Standard Action" button on the toolbar of the Custom Actions page.

After that you can right-click "CostFinalize" and set up the Property Set with Formatted Custom Action described in my first response, by choosing "New Custom Action" from the context menu.

Best regards,
Cristi
______________________________
Cristi Costache
Advanced Installer Team
http://www.advancedinstaller.com/
Intellection Pty Ltd
Posts: 6
Joined: Fri Oct 12, 2007 12:47 am

Re: Force Upgrade to install to a new folder

OK, I finally got this working the way I wanted it, after much trouble!

First I tried setting up a "side by side" install, but adding custom upgrade codes to remove any pre-existing versions. This didn't work. Even though the installer detected the older versions (according to the install log file), and despite the upgrade rule action being set to "Find and Remove Products", it would only find them and not remove them. It is like it always does the "Detect only" option if the mode is "side-by-side". If that is the case, the UI should reflect it.

However, in the end I defeated AI, and got it to do what I wanted. I went back to my original "Automatic Upgrade" mode, and used the log file to identify where is set the APPDIR. It is in the InstallUISequence, in a hidden step just before CostFinalize. I added a custom "Directory Set with Formatted" step to CostFinalize, and made it set APPDIR to "[ProgramFilesFolder][Manufacturer]\[ProductName]\". Bingo! It uninstalls the previous version, but installs itslef into its own folder.

Cristi, I had tried setting the AI_UPGRADE property in "InstallExecuteSequence -> CostFinalize", but to no effect. I didn't make that clear in my previous post. I then tried the other locations as experiments. The above solution works well, because it shows the correct folder to the user during the UI phase, as well as ignoring the previous versions folder.

Knowing what I do now, I think I would have been better off to originally have set set the APPDIR to the root folder ("[ProgramFilesFolder][Manufacturer]\"), and hard-coded the version-specific subfolder under the Application Folder in the Files and Folders page. That would have avoided the need to do these special actions.

In any case, thank you for your help and attention!
ericw
Posts: 3
Joined: Thu Jan 05, 2017 7:09 pm

Re: Force Upgrade to install to a new folder

I know this thread is very old but since I found it while searching for a solution i wanted to add an update.
Current versions of AdvancedInstaller have an option on the Upgrades page named "Use Original installation path when upgrading". It is checked by default. If you uncheck this option it will use the new folder path. You can see it in the user guide here: http://www.advancedinstaller.com/user-g ... rades.html

I haven't tested if it works for quiet installs. Maybe someone from AdvancedInstaller can confirm it works for quiet installs also?
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Force Upgrade to install to a new folder

Hello and welcome to our forums,
I haven't tested if it works for quiet installs. Maybe someone from AdvancedInstaller can confirm it works for quiet installs also?
Yes, the new path will be used in silent installation too, when the "Use Original installation path when upgrading" option is unchecked.

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

Return to “Common Problems”