frjames
Posts: 27
Joined: Wed Apr 18, 2012 8:40 pm

web.config replacement

Tried following this guide: http://www.advancedinstaller.com/user-g ... -file.html

but my file isn't getting changed. I want to use the properties that are input in my SQLConnectionDlg. Tried with and without brackets:

<add name="LocalSqlServer" connectionString="server=SERVER_PROP;Initial Catalog=DATABASE_PROP;uid=USERNAME_PROP;pwd=PASSWORD_PROP" providerName="System.Data.SqlClient"/>

<add name="LocalSqlServer" connectionString="server=[SERVER_PROP];Initial Catalog=[DATABASE_PROP];uid=[USERNAME_PROP];pwd=[PASSWORD_PROP]" providerName="System.Data.SqlClient"/>

Is there something I need to do to tell the installer to parse the web.config? It's imported under files and folders but haven't changed any properties. I'm able to do script replacements on my sql scripts but not this.

Thanks.
frjames
Posts: 27
Joined: Wed Apr 18, 2012 8:40 pm

Re: web.config replacement

Do I have to add the file as a regular file and also import as an xml file? - your help mentions that. After importing as an xml file - what do I edit exactly? I had added the property tokens into the file before importing, and when I hover the node, it tooltips the content, but nothing is in the text area. Confused.
frjames
Posts: 27
Joined: Wed Apr 18, 2012 8:40 pm

Re: web.config replacement

I got it to work by going to the attributes tab under connectionStrings and editing the brackets for each connectionString - which were messed up. Didn't need to add the file twice either.
frjames
Posts: 27
Joined: Wed Apr 18, 2012 8:40 pm

Re: web.config replacement

What's the process on web.config files during upgrades? I believe uninstall wipes out the file, but then we'll have to regenerate it again, and the client may have made changes. We also could push out occasional web.config changes. Is there a way to persist this file and just update the differences? Or is it best to wipe it out and hope for the best?
Bogdan
Posts: 2794
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: web.config replacement

By default the XML files are removed too, as any normal file from the package. If you want them to persist you should use the attribute "Remove file on uninstall" from "Install" tab, in our predefined XML editor from Files and Folders page.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
frjames
Posts: 27
Joined: Wed Apr 18, 2012 8:40 pm

Re: web.config replacement

Bogdan wrote:If you want them to persist you should use the attribute "Remove file on uninstall" from "Install" tab, in our predefined XML editor from Files and Folders page.
So to persist remove it on uninstall? Do you mean don't remove on uninstall???
Bogdan
Posts: 2794
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: web.config replacement

When I said use the attribute "Remove file on uninstall" I meant to untick it, so that during the uninstall the uninstall the file will not be removed by the MSI.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
frjames
Posts: 27
Joined: Wed Apr 18, 2012 8:40 pm

Re: web.config replacement

If I keep the web.config on uninstall, can I condition the new web.config on install to not overwrite? If so, how? Thanks.
Bogdan
Posts: 2794
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: web.config replacement

Each element from the XML has update settings visible in our XML editor, all you need to do is to check all of them, so the package will simply ignore the element.

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

Return to “Building Installers”