We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

odaniel
Posts: 10
Joined: Thu May 14, 2020 3:33 pm

Side by side with INI modification

Hello,

I'm trying to create an installer that will allow for side by side installations however I want the installer to modify some entries in an INI file while leaving other entries untouched.

Basically I want the user to install either of 2 major versions of an application that use an INI file for configuration. Some of the INI entries may be adjusted by the user from within the application and I want them to be preserved across new installations. Other entries are set to default values that the user cannot modify and will be different between major versions of the application.

I have selected option "allow side by installs of different product versions" in the Upgrades page.

The INI file was imported in the Files and Folders page the to the application folder (which will be in the Application Data folder not Program Files). After I imported the INI file, I picked the entries that I wanted to keep as their default and set them to "Create or update". The items that may be changed by the user were set to "Create only if it does not exist".

With this setup, if I install the different major version over the current application, all INI file entries are reset to their default values in the installer. The entries that were marked as "Create or update" are still being changed even though they already exist.

Is there a way to preserve some INI entries when installing a different major version that I'm not seeing?

Thanks in advance
Catalin
Posts: 7853
Joined: Wed Jun 13, 2018 7:49 am

Re: Side by side with INI modification

Hello Daniel and welcome to Advanced Installer forums,

In order to preserve your INI file during an upgrade, you can proceed as it follows:

- go to "Files and Folders" page

- double click on your INI file --> "Operations" tab --> select the "Do not overwrite existing file" radio button and then set the condition to:

Code: Select all

OLDPRODUCTS
Hope this helps.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
odaniel
Posts: 10
Joined: Thu May 14, 2020 3:33 pm

Re: Side by side with INI modification

Hi Catalin,

Thanks for responding so quickly. I proceeded as asked, but when I double-clicked the INI file in "Files and Folders", I got the Edit INI File dialog which doesn't show an Operations Tab.

Just to clarify, the INI file was imported so that I could select which INI entries to overwrite versus preserve during the installation of a new version. I'm not sure if using Import INI may have changed my options.

I'm attaching a screenshot of the dialog as I see it.
Attachments
Clip.png
Clip.png (22.26 KiB) Viewed 5126 times
Catalin
Posts: 7853
Joined: Wed Jun 13, 2018 7:49 am

Re: Side by side with INI modification

Hello Oliver,

Please ignore my latest thread. It seems I misunderstood your scenario.
Just to clarify, the INI file was imported so that I could select which INI entries to overwrite versus preserve during the installation of a new version. I'm not sure if using Import INI may have changed my options.
Indeed, this is the reason why the specified options are not there for you.

Just to make sure I fully understand your scenario:

You mentioned that you have enabled the side-by-side installation. However, are you installing the newer version side-by-side or are you simply upgrading the older version?

If it is the latter, then the reason why your INI file values are reset is because the file is removed by the newer version.

Or is it that you are expecting, when launching the newer setup, the .INI file to have the same values from previous installation?

If this is the case, then we might need to preserve them (because, by default, the values are not preserved, since the setup file will consider the INI file different from the previous one). To do so, you can write the values written by your user in the registries and the perform a registry search in the new version which will search for that registry entry and then, through a set property custom action, set the property from your INI file to the property of the search (which stores the registry entry, basically the older value).

Hope this helps.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
odaniel
Posts: 10
Joined: Thu May 14, 2020 3:33 pm

Re: Side by side with INI modification

Hi Catalin,

I'm trying to create an installer that can upgrade as well as downgrade versions of the application. Since the built-in upgrade support does not allow for downgrading, I felt side-by-side would handle what I needed.

Assume that all INI entries are common to all versions of the application. During the installation of either a newer or older version, I'd like to have a couple of INI entries reset to their default values while leaving the other entries unmodified. However for a first time (new) installation, the entire file should be copied.

Based on your description I'm not sure exactly what importing an INI file actually does if it still overwrites the existing file. Under what conditions will it preserve the existing file and perform the "create/update" modifications per entry as indicated in the dialog above?

I may have to scrap this approach. If anything else comes to mind, please let me know.

Thank you,

Oliver
Catalin
Posts: 7853
Joined: Wed Jun 13, 2018 7:49 am

Re: Side by side with INI modification

Hello Oliver,

Thank you for your followup on this.

I believe it is clear for me now what you want to achieve.

Here is a method which hopefully will help you.

So, as you have earlier mentioned, some values are written in your .INI file by the users, at install time, through the UI controls.

UIControl.png
UIControl.png (240.02 KiB) Viewed 5093 times
PropertyINI.png
PropertyINI.png (91.77 KiB) Viewed 5093 times

As you can see above, each UI control has a property assigned to it that stores the value (in our case, the value is whatever the user inputs at install time).

We then try to write this value in our INI value by using the installer property.

Normally, in an upgrade scenario, the value of the property is indeed reseted to the default value.

However, we can change this behavior. We can mark our proeprty as being a "Persistent property", meaning that it will keep its value during an upgrade scenario.

How this works is basically as it follows:

- at install time, we automatically write the value of the property in a registry entry

- during an upgrade, we perform a search to get the value of the property

- we then rewrite the property (which now has the default value) with the older value

In order to set a property as persistent, we need to proceed as it follows:
  • go to "Install Parameters" page
  • by defualt, our UI property is empty, since the user did not get the chance to write anything in it at this point. Due to this, the property will not be shown in the "Install Parameters" page
  • in order to see the properties used in dialog controls, we will need to check the "Show properties with empty values or used in dialog controls" option
After doing so, the property will now be displayed.
  • please double click on it and:
1. check the "Set persistent property" option

2. add a comment

EditProperty.png
EditProperty.png (12.36 KiB) Viewed 5093 times

This way, the property will become persistent and it will keep its values during an upgrade. This means that your INI files will always have the values that were written during a first time install, unless the user decides to modify it.

Hope this helps.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
odaniel
Posts: 10
Joined: Thu May 14, 2020 3:33 pm

Re: Side by side with INI modification

Thank you Catalin! This looks like it will do the trick. Appreciate it.

Oliver
Catalin
Posts: 7853
Joined: Wed Jun 13, 2018 7:49 am

Re: Side by side with INI modification

You are always welcome, Oliver!

I am glad everything works as expected now. It's always my pleasure to help.


Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”