Replacing "appSettings" configuration section with external file...

A handy trick I frequently show people is to load your global App.Config settings from a separate Config file:

"App.Config" or "Web.Config" file:

<configuration>
  <appSettings file="GlobalSettings.Config"/>
</configuration>

"GlobalSettings.Config" file:

<?xml version="1.0" encoding="utf-8" ?>
<appSettings>
  <add key="Environment" value="Development" />
  <add key="CustomerDBConnectionString"
 value="..." />
</appSettings>

This can be useful for deploying environment-specific settings, or for a sharing settings across multiple Web.Config files.

NOTE: By doing this, you lose the file-system watcher functions which auto-reload the config file after any change.

No Comments