Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8138075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T11:22:55+00:00 2026-06-06T11:22:55+00:00

InstallShield includes the ability to modify an applications .config file via XML File Changes*…

  • 0

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
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T11:22:57+00:00Added an answer on June 6, 2026 at 11:22 am

    [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

    #define CO_APPCONFIG_DLL "MyCompany.InstallShield.AppConfig.dll"
    #define CO_APPCONFIG_FQNAME "MyCompany.InstallShield.AppConfig.ConfigMgr"
    
    #define CO_APPSETTINGS_NEW "MyApp_AppSettings.xml"
    #define CO_APPSETTINGS_CONFIG "MyCompany.IOAnywhere.Dashboard.exe.config"
    #define CO_APPSETTINGS_SECTION "CO_dashboard"
    
    //---------------------------------------------------------------------------
    // The Installed event is sent after the feature Dashboard
    // is installed.
    //---------------------------------------------------------------------------
    export prototype Dashboard_Installed();
    function Dashboard_Installed()
    BOOL bResult;
    OBJECT oAppConfig;
    begin
    
    try
        // Note: the configuration dll is in the support directory
        set oAppConfig = DotNetCoCreateObject(SUPPORTDIR ^ CO_APPCONFIG_DLL, CO_APPCONFIG_FQNAME, "");
    catch
        MessageBox("Error Loading" + SUPPORTDIR ^ CO_APPCONFIG_DLL + ": " + Err.Number + " " + Err.Description, INFORMATION); 
        abort;
    endcatch;
    
    try
        // Note: the new configuration settings file should be in the same folder as the setup.exe
        bResult = oAppConfig.ConfigureSettings(CO_APPSETTINGS_NEW, TARGETDIR ^ CO_APPSETTINGS_CONFIG, CO_APPSETTINGS_SECTION);
    catch
        MessageBox("Verify that the file " + CO_APPSETTINGS_NEW + " exists in the setup directory.  Error calling ConfigureSettings " + SUPPORTDIR ^ CO_APPCONFIG_DLL + " " + Err.Number + " " + Err.Description, INFORMATION);
    endcatch;
    
    end;
    

    Called DLL

    using System;
    using System.Xml;
    
    /// <summary>
    /// Called by InstallShield Installer process to apply appSettings to an installed applications .config file
    /// </summary>
    namespace CO.InstallShield.AppConfig
    {
        /// <summary>
        /// ConfigMgr is the class that encapsulates functionality related to modifying a .config file
        /// </summary>
        public class ConfigMgr
        {
            /// <summary>
            /// ConfigureSettings applies changes from a common xml file to the applications .config file
            /// </summary>
            /// <remarks>
            /// Ensures required keys for the application are included in the .config file
            /// Applies common settings to the .config file
            /// Applies application specific settings to the .config file
            /// </remarks>
            /// <param name="configFilePath">Path to the xml file that has the setting that need to be applied</param>
            /// <param name="targetAppConfigPath">Path to the .config file for the appliction</param>
            /// <param name="targetAppName">Section in the xml file that has application specific settings</param>
            /// <returns>True if it was able to configure settings</returns>
            public bool ConfigureSettings(string configFilePath, string targetAppConfigPath, string targetAppName)
            {
                bool completed = false;
    
                try
                {
                    XmlDocument configFileDoc = new XmlDocument();
                    configFileDoc.Load(configFilePath);
    
                    XmlDocument targetAppConfigDoc = new XmlDocument();
                    targetAppConfigDoc.Load(targetAppConfigPath);
    
                    // ensure the appSettings section exists
                    AddRequiredSections(ref targetAppConfigDoc);
    
                    // ensure all required keys exist in the target .config file
                    AddRequiredKeys(configFileDoc.SelectSingleNode("configuration/" + targetAppName + "/requiredKeys"), ref targetAppConfigDoc);
    
                    // loop through each key in the common section of the configuration file
                    AddKeyValues(configFileDoc.SelectSingleNode("configuration/common/appSettings"), ref targetAppConfigDoc);
    
                    // loop through each key in the app specific section of the configuration file - it will override the standard configuration
                    AddKeyValues(configFileDoc.SelectSingleNode("configuration/" + targetAppName + "/appSettings"), ref targetAppConfigDoc);
    
                    // save it off
                    targetAppConfigDoc.Save(targetAppConfigPath);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                finally
                {
                    completed = true;
                }
                return completed;
            }
            private void AddRequiredSections(ref XmlDocument targeAppConfigDoc)
            {
                // Ensure the target .config file has an appSettings section... unusual but evidently possible
                if (targeAppConfigDoc.SelectSingleNode("configuration/appSettings") == null)
                    targeAppConfigDoc.SelectSingleNode("configuration").AppendChild(targeAppConfigDoc.CreateNode(XmlNodeType.Element, "appSettings", null));
            }
            private void AddKeyValues(XmlNode configAppNodeSet, ref XmlDocument targetAppConfigDoc)
            {
                if (configAppNodeSet == null) return; // Nothing to do
    
                foreach (XmlNode configNode in configAppNodeSet.SelectNodes("add"))
                {
                    XmlNode targetNode = targetAppConfigDoc.SelectSingleNode("configuration/appSettings/add[@key='" + configNode.Attributes["key"].Value + "']");
                    if (targetNode != null)
                    {
                        targetNode.Attributes["value"].Value = configNode.Attributes["value"].Value;
                    }
                }
            }
            private void AddRequiredKeys(XmlNode targetAppNodeSet, ref XmlDocument targetAppConfigDoc)
            {
                if (targetAppNodeSet == null) return; // Nothing to do
    
                foreach (XmlNode targetNode in targetAppNodeSet.SelectNodes("key"))
                {
                    // add the key if it doesn't already exist
                    XmlNode appNode = targetAppConfigDoc.SelectSingleNode("configuration/appSettings/add[@key='" + targetNode.Attributes["value"].Value + "']");
                    if (appNode == null)
                    {
                        appNode = targetAppConfigDoc.SelectSingleNode("configuration/appSettings");
                        XmlNode newAddNode = targetAppConfigDoc.CreateNode(XmlNodeType.Element, "add", null);
                        XmlAttribute newAddNodeKey = targetAppConfigDoc.CreateAttribute("key");
                        newAddNodeKey.Value = targetNode.Attributes["value"].Value;
                        XmlAttribute newAddNodeValue = targetAppConfigDoc.CreateAttribute("value");
                        newAddNodeValue.Value = "NotSet";
                        newAddNode.Attributes.Append(newAddNodeKey);
                        newAddNode.Attributes.Append(newAddNodeValue);
                        appNode.AppendChild(newAddNode);
                    }
                }
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can i create 64-bit setup.exe file using InstallScript project in InstallShield 2009? Documentation is
InstallShield 2009 Premier, Basic MSI Project : After uninstall completes, I want to force
In InstallShield 2009 how add MSI file to after install my mproject Install it
I'm using installshield express to write a simple installer. I need to set read/write/modify
I can create setup file in InstallShield 2009 I don't know how to add
Can InstallShield generate an .MSI file? What is the difference between the Express and
I am using Installshield 2008 Premier to edit some XML files which are already
I have an installshield installer that works fine under normal circumstances. But when I
I use InstallShield 2010 which requires a SPC/PFX and a PVK file to sign
I'm new to installshield and i need to read a .properties file prior to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.