cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
neualex
Level 3

Config file text logic when upgrading/reinstalling

New with InstallShield (inherited from the prior developer), we are running InstallShield 2016 Professional Edition, v23 SP2 to build our software MSI installation file.

Our software installs a web application and a web service where certain sections in the web.config file are unique to each user (customer).

We have a template web.config file with such sections blank and we add additional library references on every release in the other corresponding sections in the web.config file template.

Is it possible to have InstallShield use this template web.config file with the updated library references and merge the user-specific sections from the existing web.config file when reinstalling/upgrading?

If merging is not possible, is it possible to check if a web.config file exists and grab such user-specific sections from the existing web.config file and inject them to the template web.config file?

Please advise and thank you for reading.
Labels (1)
0 Kudos
(6) Replies
rguggisberg
Level 13

Look under SYSTEM CONFIGURATION. You can probably use 'XML File Changes' or 'Text File Changes' to do what you need to do.
neualex
Level 3

rguggisberg wrote:
Look under SYSTEM CONFIGURATION. You can probably use 'XML File Changes' or 'Text File Changes' to do what you need to do.


Reviewing Help topics, I found a way to search content inside an XML file (Behavior an Logic/System Search) for the existing ConnectionString entry inside web.config file and save such entry on a property.

Now, on XML File Changes, is it possible to have a condition to set the value for the element?

For instance...

If property is blank, set ConnectingString to default value.
If property is not blank, set ConnectionString to prperty
0 Kudos
rguggisberg
Level 13

Yes. You can put a condition on this.
Make 2 items under XML Files and name them something like:
1. DefaultConnectionString
2. PropertyConnectionString
A component will be created for each one. You can then go to the Components view under ORGANIZATION and apply the proper condition on the components.
0 Kudos
Christopher_Pai
Level 16

web.config schema allows for a second file ( AppSettings file= ) to be specified that contains override values. This allows for the web.config to have stock files and always be safely overwritten by the installer and the override file values ( if exists ) will automatically be merged together when your application goes to read it's settings. More information can be found here:

https://docs.microsoft.com/en-us/dotnet/framework/configure-apps/file-schema/appsettings/appsettings-element-for-configuration
0 Kudos
neualex
Level 3

rguggisberg wrote:
Yes. You can put a condition on this.
Make 2 items under XML Files and name them something like:
1. DefaultConnectionString
2. PropertyConnectionString
A component will be created for each one. You can then go to the Components view under ORGANIZATION and apply the proper condition on the components.


Thanks for the prompt response.
0 Kudos
neualex
Level 3

Christopher Painter wrote:
web.config schema allows for a second file ( AppSettings file= ) to be specified that contains override values. This allows for the web.config to have stock files and always be safely overwritten by the installer and the override file values ( if exists ) will automatically be merged together when your application goes to read it's settings. More information can be found here:

https://docs.microsoft.com/en-us/dotnet/framework/configure-apps/file-schema/appsettings/appsettings-element-for-configuration


Great! I tested this approach and we plan to move forward with it. Thank you!
0 Kudos