Why my changes of AppSettings in App.config is not taken into account in run-time? (Console Application)

Viewed 30982

I have a console application which has its own App.config.

I need to change some values in section time to time.

My problem is, when I execute the exe within the bin/debug folder it gets the relevant appsettings correctly. But when I edit and change values of some key/value pairs and RE-RUN the exe, it still reads the original values.

(By RE-RUN I mean running the application on the command promt by calling MyTool.exe)

I tried to call

ConfigurationManager.RefreshSection("appSettings");

in the begining of my Main method. But did not help.

Can you please advise? Thanks

3 Answers

For me I had to manually delete the application.exe.config located in /obj/Debug/ as this was basically acting like a cache. So anytime I would edit my app.config, (re)build, but looked at the application.exe.config, it was not fully updated after the build. Doing the above allowed me to force the IDE to recreate the application.exe.config in the /bin/

Related