IT:AD:NConfig:HowTo:Configure within Desktop Apps

Summary

Process

You just have to remember that in desktop apps, the files have to be included in the project, in order to Content/Copied to the destination Bin…

Note that in web apps, you don't include the file in the project – Web solutions don't copy files to a sub bin).

        static void Main(string[] args)
        {

            //Local Path:
            //NConfigurator.UsingFiles("..\\..\\Config\\Custom.config", "..\\..\\Config\\Connections.config").SetAsSystemDefault();
            //Also works in Solution sharing across projects:
            NConfigurator.UsingFiles("..\\..\\Config\\Custom.config", "..\\..\\Config\\Connections.config").SetAsSystemDefault();

            Console.WriteLine(System.Configuration.ConfigurationManager.AppSettings["KeyA"]);
            Console.WriteLine(System.Configuration.ConfigurationManager.AppSettings["KeyB"]);


            Console.WriteLine(System.Configuration.ConfigurationManager.ConnectionStrings["ABC"].ConnectionString);
            Console.WriteLine(System.Configuration.ConfigurationManager.ConnectionStrings["DEF"].ConnectionString);
        }

Correctly merges the settings from SKYSW7LT and the underlying web.config:

No fuss.