mgorga
Posts: 45
Joined: Fri Jun 03, 2011 1:00 pm

Problem with Search XML: backup some installed file tags

Dears,
I'm trying to overriding the XML web.config of my ASP.NET application. It is working but I want to backup and restore some of the tags. I followed this thread to do this:
http://www.advancedinstaller.com/forums ... =2&t=19513

I've made:
1. The web.config file is on isolated component marked as "permanent"
2. I use the installation type "uninstall old version first and then install new version"
3. The web.config file is marked as "override only if existing file is older" (If I try to mark it as "not override" it is no possible to update it with XML Update)
4. I'm using Advanced Installer 10.3
5. I use a XML Search to store a value of the web.config in a property AGENTWS_URL
6. I use an XML update to recover the data from the property AGENTWS_URL

The XML Search is working if I use a static path, in my case, I use "C:\inetpub\wwwroot\webagent\Web.config" on the "File Path" of the search. With this path, when I make and installation the web.config preserves the data. But I can not use a static path because it is possible to change the installation path. So I
used the path [webagent_Dir] that is supposed to be the destination path selected during the installation. With this dynamic path the property is not updated. I've made a log of my test.

LOG with static path (it works):
MSI (c) (30:78) [14:27:12:273]: Doing action: AI_XmlLocator
Action 14:27:12: AI_XmlLocator. Executing XML locators
Action start 14:27:12: AI_XmlLocator.
MSI (c) (30:3C) [14:27:12:277]: Invoking remote custom action. DLL: C:\Users\presence\AppData\Local\Temp\MSIB35B.tmp, Entrypoint: OnXmlLocator
AI_XmlLocator: Executing XML file: "C:\inetpub\wwwroot\webagent\Web.config" locators
MSI (c) (30!EC) [14:27:12:354]: PROPERTY CHANGE: Deleting AGENTWS_URL property. Its current value is ' '.
Action ended 14:27:12: AI_XmlLocator. Return value 1.



LOG with dynamic path (it fails):
MSI (c) (78:8C) [14:19:20:556]: Doing action: AI_XmlLocator
Action 14:19:20: AI_XmlLocator. Executing XML locators
Action start 14:19:20: AI_XmlLocator.
MSI (c) (78:DC) [14:19:20:559]: Invoking remote custom action. DLL: C:\Users\presence\AppData\Local\Temp\MSI80B7.tmp, Entrypoint: OnXmlLocator
Action ended 14:19:20: AI_XmlLocator. Return value 1.


Best regards,
Mario
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Problem with Search XML: backup some installed file tags

Hi Mario,

I'm not sure why you encounter this behavior. Are you sure that the [webagent_Dir] property contains exactly the path to the "Web.config" file during the installation (i.e. "C:\inetpub\wwwroot\webagent\Web.config")?

If so, can you please send us the .AIP (project file) and a verbose log of the installation to support at advancedinstaller dot com so we can investigate them?

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Problem with Search XML: backup some installed file tags

Hi Mario,

The [webagent_Dir] property is not resolved when the XML search is performed, so the path to the "Web.config" file is not available.

In order to achieve what you want you can go in the Table Editor page, "InstallUISequence" table and set the "AI_XmlLocator" action to run after "CostFinalize" action by modifying its "Sequence" value (i.e. write "1005" instead of "101" for the "AI_XmlLocator" action).

Let us know if this helped.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
mgorga
Posts: 45
Joined: Fri Jun 03, 2011 1:00 pm

Re: Problem with Search XML: backup some installed file tags

Great!
It works. Although it would be nice to have a feature more intuitive to override a XML file but maintaining some tags of existing files. I know it is better do not use the installation process to set or backup the configuration files of the application (XML files) but this is not always possible. In fact, it is complicated with web.config file of a ASP.NET application because this file is used to configure IIS and it is no possible to use an application configuration file myApplication.config to do that.

Thank you Eusebiu,

Best regards,
Mario
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Problem with Search XML: backup some installed file tags

You're welcome Mario. I'm glad you got this working.

We'll consider your suggestion for adding this feature, but for the moment there are not immediate plans. Thank you for your suggestion.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
raghu.00a@gmail.com
Posts: 27
Joined: Tue May 10, 2016 11:18 am

Re: Problem with Search XML: backup some installed file tags

Hi,

How to store web.config content in the property while installer is running?

Regards
Raghu
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Problem with Search XML: backup some installed file tags

Hello Raghu,

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

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

Return to “Common Problems”