1

In ABC.exe.config (app.config)

<configuration>
    <appSettings file="MySettings.config">
        <add key="setting1" value="1" />
    </appSettings>
<configuration>

Here I use "file" attribute, not "configSource", because I want to define default values. How to save to external config file "MySettings.config"? I must keep "ABC.exe.config" unchanged because it will be overwritten on program upgrade without notice. All global settings must be preserved in "MySettings.config"

linquize
  • 19,828
  • 10
  • 59
  • 83
  • possible duplicate of [Automatically "upgrade" user settings from previous version of app.config file?](http://stackoverflow.com/questions/1198193/automatically-upgrade-user-settings-from-previous-version-of-app-config-file) – McGarnagle Sep 15 '12 at 04:23
  • 1
    No! This is not the duplicate. I do not use the upgrade method, which stores settings in User account (local). I need to save global settings which stores in the exe folder. – linquize Sep 15 '12 at 04:55

1 Answers1

4

There is an example in the MSDN documentation , the approach is to handle the write to the file yourself, i.e. treat it as a "regular" XML file for example.

Tommy Grovnes
  • 4,126
  • 2
  • 25
  • 40