2

I'm trying to create simple application/user settings for my WPF application.

Most answers and tutorials suggest using Properties.Settings.Default for this.
However, Settings doesn't exist in my Properties namespace.
There is also no .settings file in my project explorer, as the microsoft documentation suggests:

  1. Open Visual Studio.
  2. In Solution Explorer, expand the Properties node of your project.
  3. Double-click the .settings file in which you want to add a new setting. The default name for this file is Settings.settings.

Solution explorer

Also there is no Settings tab in my project properties window, as some (older?) resources suggest.

Project properties window

Faygris
  • 175
  • 3
  • 8

2 Answers2

5

Check out this answer: https://stackoverflow.com/a/58423458/10703868

Looks like you are using .NET Core instead of .NET Framework with WPF. Right click on your MyApp Project and add a new folder titled "Properties". Then right click on that and add a new item. Search for settings, add the settings file. They you should be able to use this.

enter image description here

I don't see the settings tab in my project properties view, but if you right click on the settings file you can change the Open with to be the settings designer for the old view.

Peter Boone
  • 1,193
  • 1
  • 12
  • 20
  • 1
    So it was that simple. Thanks a lot! How come I couldn't find an answer in the Microsoft documentation? It's not really obvious from my point of view – Faygris Sep 11 '20 at 18:21
  • Yeah, it can be a little tough to keep track of .NET Core and Foundation documentation and answers. I had a lot of issues with EF 6 vs EF Core. I've started paying closer attention to the names and versions as well as the date. – Peter Boone Sep 11 '20 at 18:54
1

WPF App (.NET Core) template doesn't seem to be adding .settings file by default, as opposed to WPF App (.NET Framework).

You can add it by right clicking your project file -> Add -> New Item... -> Settings File (you can search for it, or browse for it under Visual C# -> General).

lv1
  • 66
  • 1
  • 7