views:

1817

answers:

1

Is it possible to create a custom configuration file (other than app.config) that can be processed by classes in the System.Configuration namespace?

I have seen a ton of articles that talk about custom sections (inside the app.config file) but I would like to make an entirely new config file.

Is there any decent documentation that covers this topic?

thanks

+1  A: 

You do not state what you want to achieve by having a separate file, but there are a couple of different things you can do.

If you want to "modularize" you configuration, you can break out certain config sections to separate files, using the configSource attribute:

// point out a file containing the connectionStrings config section
<connectionStrings configSource="connections.config"></connectionStrings>

You can also open a specific configuration file by calling ConfigurationManager.OpenExeConfiguration.

Fredrik Mörk