Can multiple C# apps use one App.Config file?

You can point to external config files inside your application's configuration file like the following, and have all your applications use the same set of settings from a single file:

<appSettings file="c:\CommonSettings.config">
   <add key="MyKey" value="12"/> 
</appSettings>

For more information, you can read following articles:

  • AppSettings can Reference an External Config File
  • How to share custom application configuration settings across projects in .NET

It is not directly possible to share one application configuration file because the .config filename needs to match the executable name (so for example.exe it would be example.exe.config).

It makes sense to have separate values for the different applications, as they are separate applications.

If there are configuration sections that you do want to share, you can use the configSource attribute to point to a file. The appSettings section also has a specific file attribute that you can use in the same manner.

If there are certain configuration values that are shared across all applications, you can consider placing them in the machine.config file for the version of the framework you are using.


Can you use custom xml files to store configuration data ? There's no necessity to use app.config.

Tags:

C#

.Net