I´ve started using application configurations in C# for almost everything I write.

It´s standard, has good integration and classes all fixed up for you.

However, I´ve found one problem. When testing or otherwise having the need for several different configuration files the ConfigurationManager lacks a method to open any named configurationfile.

You would think:


would work but then you will need an exe that maps to the configuration.

I found this thread that makes use of an ExeConfigurationFileMap to solve this, superb!

var map = new ExeConfigurationFileMap { ExeConfigFilename = "myConfig.conf" };
config = ConfigurationManager.OpenMappedExeConfiguration(map, ConfigurationUserLevel.None);

This way we can open any configuration file regardless of name or exe presence.