0

I am trying to create a string1 in My.Settings and used the My.Settings.Save method and it is working perfect. The problem is that the default value is "My Name is X" and the given saved value at runtime is "My Name is Z", when the next time I run the debugger in VS2010 with F5 key i am getting the new value only not the original x, I tried to clean, rebuild the app but still the new value is only showing up, how to debug with original values?

Thank you.

surpavan
  • 1,372
  • 7
  • 34
  • 66

1 Answers1

1

I think you have to delete the generated settings file (stored in C:/Users/...) in each debug session, or else in your code inside the initialize part you could do something like this:

#if Debug
     YourApp.Properties.Settings.Default.String1 = "My name is X";
     YourApp.Properties.Settings.Default.Save();
#endif
Eduardo Brites
  • 4,597
  • 5
  • 36
  • 51
  • But shouldn't there be to reset the output while building, I though building f5 would start the project from code compilation, why would it start with old settings after clean? – surpavan May 17 '12 at 10:49
  • I don't think it's possible, although you can delete the file automatically as a post build event command line. This link talks about it http://stackoverflow.com/questions/2903610/visual-studio-reset-user-settings-when-debugging – Eduardo Brites May 17 '12 at 10:54
  • But is there a way to delete user settings after app install or at app uninstall? – surpavan May 17 '12 at 11:07
  • If you change the assembly version of your application in each setup, the user settings are renewed because it creates a new settings file. – Eduardo Brites May 17 '12 at 11:13