Tatyana Mykhnevych
Posts: 40
Joined: Thu Feb 13, 2020 4:47 pm

Edit .json file on install

Tue Aug 17, 2021 12:13 pm

Hello,

My Advanced Installer version is 18.3.
I have an appsettings.json file as a part of the installation package. Currently, it is never overwritten if a new version is installed over the old one.
I need to have an opportunity to update some values in this file or add new ones but not overwrite some existing values. I read an article
https://www.advancedinstaller.com/user- ... files.html but it does not help.

I tried two different ways:
1) Do not remove the initial appsettings.json file that is part of the installation package. Add new with the same name but with type Windows Installer JSON file and update some values there. Nothing is changed.
2) Remove the initial appsettings.json file that is part of the installation package. Create new with all the same values but with type Windows Installer JSON file. Add some new values and unselect Update if found for some other values. If Update if found unselected then this key removed at all! If Update if found selected then value is overwritten.

How can I manage values in appsettings.json and update only needed for me?

Looking forward to hearing from you.

Best regards,
Tanya
Attachments
Untitled.png
Untitled.png (75.17KiB)Viewed 16660 times

Liviu
Posts: 1026
Joined: Tue Jul 13, 2021 11:29 am
Contact:  Website

Re: Edit .json file on install

Wed Aug 18, 2021 8:40 am

Hi Tanya,

I investigated it and tried to reproduce the behavior, but I was not able to replicate it.

On the new version of the setup, the “Update if found” option for the existing .json file on the computer works as expected, the new value is updated successfully.
If the “Update is found” option is unchecked then the respective values are not updated.

When you upgrade your application, by default “Uninstall old version first and then install new version.” option is checked.

Can you please verify on the first version of your application, that the “appsettings.json” file is not removed on uninstall? Uncheck “Remove only if it was created at install”. Also you need to uncheck that for the components you don’t want to be removed and see if that helps.
json.png
json.png (59.12KiB)Viewed 16635 times
json1.png
json1.png (15.3KiB)Viewed 16635 times

Otherwise, can you please send us the .AIP (setup project) file, for both versions of your project, by email to support at advancedinstaller dot com so we can further test and investigate this? And please tell us which values you want to update.

Attached you can find 2 sample projects which work as expected.

Hope this helps! If you have any other questions, please don't hesitate to contact us.

Best regards,
Liviu
Attachments
sample projects json.zip
(6.33KiB)Downloaded 449 times
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Tatyana Mykhnevych
Posts: 40
Joined: Thu Feb 13, 2020 4:47 pm

Re: Edit .json file on install

Wed Aug 18, 2021 9:54 am

Hi,

Thanks a lot for your response.

Unchecking “Remove only if it was created at install” settings helpls!

Liviu
Posts: 1026
Joined: Tue Jul 13, 2021 11:29 am
Contact:  Website

Re: Edit .json file on install

Wed Aug 18, 2021 10:01 am

You are always welcome, Tanya!

I am glad everything works as expected now.

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

SZLMCL
Posts: 26
Joined: Mon Nov 16, 2020 2:18 pm

Re: Edit .json file on install

Tue Oct 04, 2022 11:08 am

Hello,

I have version 18.7 installed and I not find the Edit Json File Dialog.
When I double click on appsettings.json file the "Edit file" dialog opens, not the "Edit JSON file" dialog.

Can you help me please how can I change my appsettings.json content?

Thank you!
appsettings.png
appsettings.png (45.21KiB)Viewed 10197 times

Liviu
Posts: 1026
Joined: Tue Jul 13, 2021 11:29 am
Contact:  Website

Re: Edit .json file on install

Tue Oct 04, 2022 11:54 am

Hello,

In order to achieve this you need to add the .json file in Windows Installer format.

You have two options for this.

1. You can click on the Import Files toolbar button --> Import JSON option.

2. When you drag&drop your .json file or add it using the Add Files button an Import Files dialog will be displayed. On this prompt you need to select the checkbox in order to add the file in Windows Installer format.
WI.png
WI.png (126.18KiB)Viewed 10193 times

Hope this helps!

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

SZLMCL
Posts: 26
Joined: Mon Nov 16, 2020 2:18 pm

Re: Edit .json file on install

Thu Oct 06, 2022 8:39 am

Dear Liviu,

Thank you for help, I try import the json, but the following error message throws:
aaaaa.jpg
aaaaa.jpg (13.83KiB)Viewed 9998 times
My json is a simple json with a connection string and azure logic app url and some settings.

What is the accepted charachter encoding for Advanced Installer?

Thank you for help!

Liviu
Posts: 1026
Joined: Tue Jul 13, 2021 11:29 am
Contact:  Website

Re: Edit .json file on install

Fri Oct 07, 2022 1:56 pm

Hello,

I'm not sure why this happens.

Can you please forward to us your .json file by email to support at advancedinstaller dot com so we can further test and investigate this?

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”