supposedly myVar = MYNAME.. when I compile the code with this value it reads this as MYNAME.
now, i open this file in the /Debug directory (this is where the compiled file .exe is saved together with the other files) = Program1.vshost.exe.config
when I change the value to "ME", saves the file and run the .exe, it still gives me the first value of "MYNAME" instead of the new value "ME".
I placed Console.WriteLine to show/display the value of myVar and it always displays "MYNAME" as it's value.
The reason it doesn't change is because the app config files get autogenerated when you compile your app.
When you run your program under the ide, the *.vshost.config file is used. When you run your program outside the ide, the <programname>.exe.config file is used.
Both of these config files are regenerated from the App.Config file when you compile your app.
So if you debug your app (which generates new *.config files), change a setting in the vshost.config file and then debug your app again, the change will be overwritten.
If you need a change to persist, make a change to the program.exe.config file and run the app outside the ide.
...or make a change to the App.Config file.
Lastly, you should be using the ConfigurationManager class instead of ConfigurationSettings class as the latter has be deprecated.
Bookmarks