Visual Studio: reset user settings when debugging

Reinhard picture Reinhard · May 25, 2010 · Viewed 37.2k times · Source

In a C# Winforms-App I have several user settings stored.

Is there an easy way to clear those settings each time I start debugging the project from Visual Studio 2008?

Otherwise it always starts up with the settings from the last debug-session.

Answer

Smolla picture Smolla · Feb 15, 2013

Had the same question and found an answer here: https://stackoverflow.com/a/2117359/488794

Properties.Settings.Default.Reset()

You can use this following statement to only reset if you're debugging:

if(Debugger.IsAttached) 
   Settings.Default.Reset();

tested VS2012 .Net 4.0 (Reference)