InstallShield includes the ability to modify an applications .config file via XML File Changes*… but what if you want to share configuration settings across multiple installation packages?
In our environment we deliver a WPF application and a WinForms application where one is a management console and the other is a data collection app (single installer where users selects what they want). We also ship an installer for the service layer used by both apps so the webservice endpoints will be different at each customer location. (Actual environment is a bit more complicated but the above is an example of the complexity)
Our direction is to create an XML file that has common configuration settings for both installers that includes the common settings, InstallShield reads these values and then updates the .config file of each application to point to the same endpoints. Anyone done this? Can this be done without using InstallScript or a Custom Action?
- Importing the xml configuration file into the XML File Changes area to read in every line from the config file and creates add requests via XPath for every line (ex. add[@key=”IsMultiTouch” and @value=”True”]). This seems less than ideal as I suspect it is just recreating the file where I want it to read in the current state of the file from the dev team and only modify values in appsettings during the installation
[followUp]
Pulled values from an InstallShield dialog using CtrlGetText(), passed that data to my dll for inclusion in my apps config file. The resultant .config file entry included a large number of “” sequences.
Attempts to clean those up with InstallScript didn’t work out well.
Ultimately had to clean them up inside the dll by flipping the XmlDocument into a string, performing a .Replace(“”, “”) on the string, loaded that into a XmlDocument (to ensure it was valid), and then saved it.
InstallShield != awesome.
[/followUp]
XML File changes does not appear to be a good direction so instead I wrote a custom action that fires after the the feature is installed. The custom action calls into a managed assembly that spins through the xml file applying changes to the applications .config file.
Custom Action
Called DLL