Alin.Sarivan
Posts: 13
Joined: Thu Jul 31, 2014 7:16 am

Keep web.connfig settings from an older install path

Fri Dec 05, 2014 11:35 am

Hi all,

I have an installer for a web application.
I request some information from the user in installer UI and we're saving this data in the web.config using Advanced Installer functionality for XML files (linking appSettings nodes to properties).

At a certain version, the install directory has changed.
On upgrade, I want to search the old install directory, initialize the properties with values from the old path web.config and then save them to the new install directory.

Can you give an idea how to do this without custom scripts?

Thanks!

Dan
Posts: 4484
Joined: Wed Apr 24, 2013 3:51 pm

Re: Keep web.connfig settings from an older install path

Fri Dec 05, 2014 1:15 pm

Hello,

By default a package uses the installation path of an older version when upgrading. So, please make sure that the Use original installation path when upgrading option is enabled in the Upgrades page.
On upgrade, I want to search the old install directory, initialize the properties with values from the old path web.config and then save them to the new install directory.
For this, you can try the Creating an XML Search.

Let us know if that helped.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Alin.Sarivan
Posts: 13
Joined: Thu Jul 31, 2014 7:16 am

Re: Keep web.connfig settings from an older install path

Fri Dec 05, 2014 1:19 pm

Thanks for your reply!
I'll try it and let you know.

Alin.Sarivan
Posts: 13
Joined: Thu Jul 31, 2014 7:16 am

Re: Keep web.connfig settings from an older install path

Tue Dec 09, 2014 12:27 pm

Hi Dan,

XML Search was what I was looking for.
It worked.

Thanks!

Alin.Sarivan
Posts: 13
Joined: Thu Jul 31, 2014 7:16 am

Re: Keep web.connfig settings from an older install path

Tue Dec 09, 2014 1:05 pm

Hi Dan,

I have another question.
My web application installer has a custom dialog where the user can enter the host name and port, values that are used in Server\IIS menu to specify the HTTP bindings for the new site that the installer creates.
On an update scenario, can I retrieve these values from the existing IIS configuration? And how do I do that?

Thanks!

Alin.Sarivan
Posts: 13
Joined: Thu Jul 31, 2014 7:16 am

Re: Keep web.connfig settings from an older install path

Wed Dec 10, 2014 4:27 pm

Hi guys,

I need to reopen this problem, because I haven't found a good solution to it.

My problem:
I have an installer for a web application.
In the UI, I have custom dialogs that get information from the user.
Part of the information is used to create a new web site. It provides data for the HTTP Bindings (host name and port).
The other part of the information is stored in the web.config of the web application.
At a certain moment, the installation path of the application changed.
Now, on an upgrade scenario, I need to retrieve data based on current IIS bindings and data stored in web.config and present it to the user.

Data from web.config.
On upgrade scenario, I need to get the web.config from the previous installation, read it and store data in my custom properties.

I tried using XML Search, as Dan suggested, but I've found out that XML Search cannot use APPDIR path. It can use only paths based on Windows folders (like Program FIles x86/64...).
I need to use APPDIR property that stores the previous installation path (I've checked Product Information -> Upgrades -> Application Versions -> Use original installation path when upgrading).
I need APPDIR with the previous install path and before the dialog to change the install path appears.

Side note : The search path for XML Search is static because the AI_XmlLocator custom action is run before AI_AppSearchEx which searches for existing products and setting the APPDIR is done after AI_AppSearchEx (as I see from logs).

Data from IIS bindings
I've seen no options to retrieve data used to create the web site that the installer created.

Can you, please, help me with this issue?
How can I retrieve data from a previous web config on update scenario?
How can I retrieve data used to create HTTP bindings for an web site?

Thanks!

Dan
Posts: 4484
Joined: Wed Apr 24, 2013 3:51 pm

Re: Keep web.connfig settings from an older install path

Thu Dec 11, 2014 2:14 pm

Hi Alin,

Please take a look on the Problem with Search XML: backup some installed file tags forum thread which debates this subject.

Please let me know if that helped.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Alin.Sarivan
Posts: 13
Joined: Thu Jul 31, 2014 7:16 am

Re: Keep web.connfig settings from an older install path

Thu Dec 11, 2014 4:37 pm

Hi Dan,

It worked! Thanks!

One down, one more to go. :D

How do I get HTTP Bindings information, Host name and Port information, for a web site created with Advanced Installer.
In an upgrade scenario, I need to load this information into 2 properties, display it to the user and recreate the site based on these 2 properties.
Do you have any suggestions?

Thanks!

Dan
Posts: 4484
Joined: Wed Apr 24, 2013 3:51 pm

Re: Keep web.connfig settings from an older install path

Fri Dec 12, 2014 2:37 pm

Hi Alin,

In order to achieve that, you can use the XML locator functionality. Please take a look on the Creating an XML Search article with related information for hints and guidance.

If there is anything else I can help you with, please let me know.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Alin.Sarivan
Posts: 13
Joined: Thu Jul 31, 2014 7:16 am

Re: Keep web.connfig settings from an older install path

Fri Dec 12, 2014 4:53 pm

Hi Dan,

XML Search on what file?
We don't store this information, host name and port number, on web.config.

We get the information from user through a custom dialog, store them in properties and use them here http://www.advancedinstaller.com/user-g ... l-iis.html , when setting HTTP Bindings (see step 3 Configure Web Site Bindings first image, HTTP bindings).

Does Advanced Installer stores information about the web site it creates?
And if it does, how can I retrieve them?
If it doesn't store them, can you give me some suggestions on how to retrieve them?

Thanks!

Dan
Posts: 4484
Joined: Wed Apr 24, 2013 3:51 pm

Re: Keep web.connfig settings from an older install path

Thu Dec 18, 2014 10:35 am

Hi Alin,

I'm sorry for my delay reply.
Yes, you can store the related information provided by the user during first time install. For this, you can create a XML File in the Files and Folders view.
So, a .xml file will be creating during installation time. During an upgrade, you can retrieve the information from the related .XML file. Please take a look on the XML Locator Search article withe related information for hints and guidance.

By the way, I've attached a sample project which implements this scenario, so if you are interested to take a look directly at my project, you are more than welcome to download the ZIP file.
As you will notice, during installation the user is asked to enter some information. Please fill the related fields.
After you build and installed the sample app, you can go in the Product Details page and increase the Product version (when prompted, please select the major upgrade option). Rebuild the package and launch to install it. Notice that the fields already contains the previous entered values.

Let me know if that helped.

Best regards,
Dan
Attachments
Your Application.zip
(3.71 KiB) Downloaded 355 times
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

ahmetoz27
Posts: 1
Joined: Wed Jun 16, 2021 8:41 pm

Re: Keep web.connfig settings from an older install path

Wed Jun 16, 2021 8:44 pm

Hello i have same problem, i am making a patch for a game that can update some files, but i couldnt manage to make auto path find search doesnt work i dont know how to do it.
Example my game installed at "D:\Oyunlar\Steam\steamapps\common\Fallout 3 goty"
I want my patch find this location automaticaly, becouse other players "Fallout 3 goty" can be at C:\ Or somewhere else.
Help please

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

Re: Keep web.connfig settings from an older install path

Thu Jul 01, 2021 2:45 pm

Hello and welcome to our forums,

Instead of a patch, you could try to create a major upgrade and have the "Use original installation path when upgrading" option enabled in the "Upgrades" page.

In order to create a major upgrade, all you have to do is:

- increase the version (e.g. from 1.0.0 to 1.0.1)

- when being asked to generate a new Product Code, select "Generate new"

This way, the upgraded version will always remember the previous installation path.

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

Return to “Building Installers”