views:

317

answers:

3

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?

Thanks in advance for any replies.

+2  A: 

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

DOK
+1  A: 

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

Kevin
Good idea if the values apply to every app. On a hosted site or web farm where you can't control, or don't even know, what other web app's are running on the servers, this might not be feasible.
DOK
Good point. I guess I have gotten spoiled with every company I've worked for owning the servers we place the applications on.
Kevin
A: 

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

<appSetting configSource="somefile.config"/>
Thad