Web.Config elements repeated - Advanced Installer Community

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!

viral
Posts: 22
Joined: Thu Jun 23, 2011 9:07 am

Web.Config elements repeated

Hi,

When my application is installed using AI and if web.config is already exists at installation location then all the elements in web.config are added again. So for example if there is <AppSettings> element is there in web.config then it is added again. And this is giving error while running my web application.

so can you please help me how can I stop this behavior of AI. I want web.config updated entirely with new one from my AI

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

Re: Web.Config elements repeated

Hi Viral,

Can you please check the settings from "Element Settings" tab, in the XML Editor, to see if the element is set for update
in case it is already found on the machine?

The default option is to add the new node as a sibling, not to update it, but this you can easily change.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
viral
Posts: 22
Joined: Thu Jun 23, 2011 9:07 am

Re: Web.Config elements repeated

Yes. I have set option

If the element is found >> Update >> First Matching

for each XML element in web.config file. But it is creating same element two times in web.config at the end of installation

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

Re: Web.Config elements repeated

Hi,

Can you please send us the aip file and the XML found by the installation on the machine to support at advancedinstaller dot com so we can investigate this behavior?

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
viral
Posts: 22
Joined: Thu Jun 23, 2011 9:07 am

Re: Web.Config elements repeated

I have sent AIP file and web.config file to support via email. Please let me know what I am doing wrong

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

Re: Web.Config elements repeated

Hi,

It seems that the sections which are duplicated need the options "Is identifier attribute" set. You can find this setting available in the
dialog Edit Attribute.

I've made a couple of tests on sections that I noticed as duplicated, after setting the above option they were not duplicated anymore.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
viral
Posts: 22
Joined: Thu Jun 23, 2011 9:07 am

Re: Web.Config elements repeated

Hi Bodgan,

I am updating some elements in web.config at run time. like connection string and some application settings.

Now if I want to replace web.config file each time installer runs then how can i do this? So when installer runs, it will overwrite the web.config along with new values
which I set at run time.

Is this possible? if yes then how?

Thanks,
VIRAL
viral
Posts: 22
Joined: Thu Jun 23, 2011 9:07 am

Re: Web.Config elements repeated

Yes. I have set option as you said.

Now in web.config I have 2-3 elements which are set at run time. like connection string, some application settings.

Now after my installer runs then it only create duplicate entries for elements which are changing at run time.

Can you please help me on this?

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

Re: Web.Config elements repeated

Hi Viral,

I've done with the connection string "myConnection" and the value for "SERVER_PROP" property from that string was correctly updated. The string was not duplicated in the
XML file. And this section doesn't even has the attribute mentioned in the above post set.

Are you sure you deleted all files before making this test?

Please note that the attribute "Is identifier attribute" was not required for all entries from the XML, but only for those that were duplicate. The user-guide explains
with more details when its usage is recommended, in the link from the previous post.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
viral
Posts: 22
Joined: Thu Jun 23, 2011 9:07 am

Re: Web.Config elements repeated

But in future if I add new elements then how will I know that, i have to set "Is identifier attribute" or not.

Is there any rule to set this property in installer?
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Web.Config elements repeated

Hi,

As our documentation says, "In order to enhance the localizing precision of matching elements, you can use identifier attributes to pinpoint an exact element from the file,
in case several nodes have the same ancestors. By enabling this option only target elements that have an attribute with the same name and value set here will be considered a match for the update."

Attributes that use in their value public properties should not use the option "Is identifier attribute" because the value of the property will always most likely be different and then the above rule will not be satisfied.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”