0

Hello i use the followin code to Restart my WPF application

System.Diagnostics.Process.Start(Application.ResourceAssembly.Location)
Application.Current.Shutdown()

However i notice when it runs again My.Settings Values are reset to defaults, any idea how to prevent this?

H.B.
  • 166,899
  • 29
  • 327
  • 400
user1570048
  • 880
  • 6
  • 35
  • 69

1 Answers1

0

Make sure you call Save() on your settings before restarting. If you do this already as part of your apps shutdown, the settings file may be locked by the new app instance, preventing the current instance from saving.

Surfbutler
  • 1,529
  • 2
  • 17
  • 38
  • well i think that the file is locked by the old app instance, because if i run the application it loads the settings fine! – user1570048 Sep 17 '12 at 08:44
  • Have you tried this method of restarting? Might work better with your settings file: http://stackoverflow.com/questions/4773632/how-do-i-restart-a-wpf-application – Surfbutler Sep 17 '12 at 08:59