How to share config settings between multiple applications
-
08-07-2019 - |
Question
I have a project where there are multiple applications that have some common configuration values. I would like to have a shared .config file that is available to all of the applications using the .Net configuration object model. Each application would also have its own app.config file
How can this best be done. I'd rather avoid using the registry as much as possible. In looking through the documentation, the OpenExeConfiguration(string exePath) method seems promising for accessing a specified config file. Is this a reasonable approach? Any other suggestions?
Solution
Here's a discussion that addresses OpenExeConfiguration which may be helpful.
OTHER TIPS
Some sections in the app.config allow for a reference to an external file.
<appSetting configSource="somefile.config"/>
I would place value in the machine config. You can then override any value you need by putting it in the individual app config.