Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to share config settings between multiple applications

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?

like image 423
E Brown Avatar asked Nov 12 '08 15:11

E Brown


People also ask

How do I share a config file between projects?

Step 1: Place the App. Config file in a folder parent to both(or all) the projects that needs to use the same Config file. I have put it in a new folder called AppConfig. Step 2: Right click on each project and select the same App.

Can we have multiple App config?

You cannot use multiple configuration files (i.e. one per library project) without coding.


1 Answers

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

<appSetting configSource="somefile.config"/>
like image 99
Thad Avatar answered Nov 02 '22 00:11

Thad