none
Configuration files - updating / merging during installation - HOWTO? RRS feed

  • Question

  • Hi. I have a .config file which was used by v1 of an application.  When I install v2 of the application, it is possible that the end-user (or more likely one of their IT guys) has made changed to it. As part of the install of v2, the v1 config file is saved.
    I have worked out a mechanism for propagating the applicationSettings stuff through using the System.Configuration stuff.
    However, there is also some WCF information (system.serviceModel bindings et al) I would also like to work with. Does anyone have any comment on whether this is a good approach, or should I just bite the bullet and manipulate the config files as XML (which would be simpler).
    Steve Spencer
    Tuesday, December 1, 2009 10:30 AM

Answers

  • It's better to process the config file as a raw XML. Just update/add neccessary elements.

    The installation process should be as much reliable as possible and has minimal external dependencies. I have used Wix for the same goal. You can use its <XmlConfig> element to describe the modifications to be applied to the config file. <XmlConfig> automatically performs rollback if your installation fails at some later stage. Doing XML manupulation as a your own custom action is not recommended - your will get a dependency on an external XML parser (System.Xml.dll is considered an an external dependency too) and you will have to implement all rollback logic yourself.

    Tuesday, December 1, 2009 11:13 AM