So, long story short, I'm developing an application that will make use of some configuration info that may be changed at runtime through the application itself. For the purpose I've thought of using the Settings
class.
The problem, thought, is that information is not persisted between different runs of the application:
Run 1)
Console.WriteLine(Settings.Default["User"]); //prints "Default user"
Settings.Default["User"] = "abc";
Console.WriteLine(Settings.Default["User"]); //prints "abc"
Run 2)
Console.WriteLine(Settings.Default["User"]); //prints "Default user"
Settings.Default["User"] = "abc";
Console.WriteLine(Settings.Default["User"]); //prints "abc"
(both print exactly the same output)
Both runs show up the same first print "Default user", although on the 2nd run I'd like to get "abc", indicating that the info is not being persisted between different application executions.
I acknowledge this must be related with the way Visual Studio handles .config files, but even so I'd like to know how to correct for this (nasty) behavior?
Save
on the settings (from MS). Or for more 'elaborate' efforts, you can doConfigurationManager.OpenExeConfiguration
(orOpenMappedExeConfiguration
) - thenSave
,SaveAs
(e.g. this ) – Bewhiskered