How do I access the Properties namespace from within a console app?

Nick picture Nick · May 12, 2009 · Viewed 24.7k times · Source

I am trying to store/retrieve a value that is stored in the Application Settings. From within my console application I can not seem to access the Properties.Setting namespace. My web surfing has revealed that a little more work might be needed to do this from within a Console application. How does one do this?

string test = Properties.Settings.Default.MyString;

Thanks!

Answer

womp picture womp · May 12, 2009

By default there is no Settings file in a Console application. However, you can add one simply by right-clicking your project in the solution explorer, choosing "Properties" and then in the resulting window, click the "Settings" tab.

There should be a link saying "Click here to create a default settings file". Once that's created, you're off to the races.