Can I create .config file and include it to web.config?

Roman Bats picture Roman Bats · Apr 24, 2012 · Viewed 31.6k times · Source

Can I create .config file and include it to web.config? How can i do this?

UPD. If you want to separate config file, for example, move appSettings to another file you must do next: In web.config

  <appSettings configSource="myAppSettings.config" />

In myAppSettings.config:

  <appSettings>
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
  </appSettings>

Answer

Oded picture Oded · Apr 24, 2012

It is not entirely clear what you want to do, but all configuration sections can be stored in a separate files and be referenced by the main .config file using the configSource property.

See this blog post for details.