Is there a way to load a user.config
file from an arbitrary location in the file system and refresh the content during run-time? I need to switch between different configuration files during run-time, but while the saving to any location works:
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal) as Configuration;
config.SaveAs(filename);
I cannot find a way to load it back again. I cannot find methods to accomplish this and my workaround to replace the user.config file in the C:\Users\...\AppData\Local\Microsoft\"appname"
folder manually and then call Properties.Settings.Default.Reload()
also does not work, although the file is correctly replaced (On the next application start it works, but after the reload-call there are no changes at all).