6
votes

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?

3
any final solution with full source code sample working about it ? - Kiquenet

3 Answers

5
votes

Some sections in the app.config allow for a reference to an external file.

<appSetting configSource="somefile.config"/>
2
votes

I would place value in the machine config. You can then override any value you need by putting it in the individual app config.

1
votes

Here's a discussion that addresses OpenExeConfiguration which may be helpful.