davidesharpe
Posts: 56
Joined: Fri Jul 01, 2011 4:56 am

How to conditionally retain user settings after update

Hi,

1. We use the Advanced Installer task within FinalBuilder to create an install package after updating the version build number. i.e from 5.1.1345 to 5.1.1346 etc etc.
2. Within the installer we ask for a few user settings Login Name, Database Name etc which get placed into a config file using text replace.
3. After the installer the user is at liberty to manually update the config file with extra connection information, as well as the standard

My question is How can I retain the standard connection info on updating the application, (uninstall, reinstall)

Ideally I would like to 'read' the standard config out of the existing config file (if there is one) and place these values into the installer dialogs, plus maybe ask the user if he wishes to retain the existing config or replace it with a fresh one.

what is the best way to achieve this ?

Thanks
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: How to conditionally retain user settings after update

Hello,
My question is How can I retain the standard connection info on updating the application, (uninstall, reinstall)
You can try to use the XML locator feature to accomplish this. Here is a tutorial to get you started.

Another method would be to save the values in the registry and retrieve them at install time using searches.

If the above don't comply, you can implement the functionality using your own custom action.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
davidesharpe
Posts: 56
Joined: Fri Jul 01, 2011 4:56 am

Re: How to conditionally retain user settings after update

Hi,

Thanks for that I had a look at using an xml search to get the settings from the config file, but had a problem doing locating them using the XML locator.

My XML file looks like this.

Code: Select all

<?xml version="1.0"?>
<configuration>
  <appSettings>
    <add key="DatabaseHandler.Provider"           value="OleDb"/>
    <add key="DatabaseHandler.ConnectionString"   value="Provider=OraOLEDB.Oracle...."/>
    <add key="DatabaseHandler.UserID"             value="User1"/>
    <add key="DatabaseHandler.EncryptedPassword"  value="User1Password"/>
  </appSettings>
</configuration>
How do I setup the XML Locators to read the values "OleDB","User1" etc into properties ?

Also do I need to ensure that uninstall leaves the file behind ? Or will the search locate this file before it is removed ?

I don't want to use Registry Values as the users are at liberty to manually update the config file if they wish, and I wish to retain those settings.

Thanks
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: How to conditionally retain user settings after update

Hi,

The search should be executed before the uninstall takes places so everything should be ok.

Regarding the configuration of the location I attached a sample and an XML file, which is exactly the one from above. Just place the file
on C partition and test the sample I attached.

Regards,
Bogdan
Attachments
Target.xml
(390 Bytes) Downloaded 747 times
example.aip
(8.51 KiB) Downloaded 762 times
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
davidesharpe
Posts: 56
Joined: Fri Jul 01, 2011 4:56 am

Re: How to conditionally retain user settings after update

Hi,

Thanks for that, I was able to get the search working there, but now i have another issue.

When I increment the version number and try to do an install of the next version from 5.1.628 to 5.1.629, then i get the Windows Installer 'Another version of this product is already installed ... to configure or remove .. use add/remove ..control panel' error message.

What do I need to do to the Installer to allow me to Install the next version, while still being able to get that information from the XML file ?

We also want to create patches too, so we need to keep the product id the same.

Is it possible to have the Installer leave the imported xml behind after an uninstall ?

We wish to be able to have a distribution along these lines,

Create version 5.1.1 - Distribute installer.msi
Create version 5.1.2 - Distribute installer.msi or patch.msp ( installer will do clean install but retain the config id if it
is reinstall/upgrade,
patch just patches 5.1.1 to 5.1.2 )
.
.
Create version 5.1.x - Distribute installer.msi or patch.msp ( installer will do clean install but retain the config id if
is reinstall/upgrade,
patch patches all installs less than 5.1.x to 5.1.x )

The normal method of upgrade will be patch, but at certain points in the development cycle, changes are likely to breakj the patch creation rules, thus we need to be able to send out an installer that can do a reinstall and retain config, then patches to that can go on until the next break of rules. etc etc

I have patches working fine, but the full install of newer version over older one is creating a problem as you can see. If you can maybe point to another stratergy for retaining the config other than the xml search ? maybe I should do 'xml search' on uninstall, and poke them away in registry for the reinstall or simillar ?

Thanks
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: How to conditionally retain user settings after update

Hello,
What do I need to do to the Installer to allow me to Install the next version, while still being able to get that information from the XML file ?
Here is why this could happen. I suspect this is happening because when changing the version, you did not change the Product Code. You selected no when prompted in order to create a patch.
Is it possible to have the Installer leave the imported xml behind after an uninstall ?
Here is an article that answers this. To keep it unchanged between upgrades you can also use our Resources -> Persistent User Data from the Wizards item in the menu bar.

We have predefined functionality to search/append( Search page, Registry page ) registry values, so you can also try to keep the upgrade log in the registry and see if that makes your life easier.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
salehi
Posts: 2
Joined: Tue Jan 05, 2016 2:46 pm

Re: How to conditionally retain user settings after update

Bogdan wrote: The search should be executed before the uninstall takes places so everything should be ok.
Hello,
I have the same problem as said below:
"Ideally I would like to 'read' the standard config out of the existing config file (if there is one) and place these values into the installer dialogs, plus maybe ask the user if he wishes to retain the existing config or replace it with a fresh one"
If I set the "File path" in search properties equal to "[APPDIR]Target.xml" , so as you said about executing search before installation, if I show DB_PROVIDER and User properties in a Dialog , it must show user values in "[APPDIR]Target.xml" (in upgrading product), but it does'nt work, just setting "File path" to addresses like c:\... work!
I success in replacing user data in config file, but search from Appdir fail!
Any help would be appreciated
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: How to conditionally retain user settings after update

Hello,

You can see my reply in the "Re: search in app dir and launch conditions" forum thread.

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

Return to “Common Problems”