3

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).

  • You can create a custom setting provider by overloading look for sample http://www.codeproject.com/Articles/20917/Creating-a-Custom-Settings-Provider http://stackoverflow.com/questions/11727654/loading-properties-settings-from-a-different-file-at-runtime – Anshul Nigam Dec 09 '14 at 08:37

0 Answers0