How to Determine Which C# Settings File Is Being Used

565 Views Asked by At

The Settings.settings file that's part of my C# application has the following User entry. It is called selected_device_idx; is an int; and its value is set to -1.

Yet, during startup, when I fetch this value, it is set to another value, 5.

I am using this to fetch the value

int temp_selected_device_idx = (int)Properties.Settings.Default["selected_device_idx"];

How can I determine where the origin of this entry?

1

There are 1 best solutions below

1
On

I am reposting @HansPassant 's comment as the answer. sz Now, I have to find out why the settings are not holding on a non-development workstation, where I am installing this application.

Hans, Thanks for the comment.

Well, if 5 isn't the default value then it comes from a user.config file. It is hard to find back because it is stored in a AppData directory with a strange name. If you can't find it then SysInternals' Process Monitor can show you. Or just write back whatever value you want and Save() it. – Hans Passant yesterday