I use sample code with article Read/Write App.Config File with .NET 2.0 listed below
// Open App.Config of executable
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
// Add an Application Setting.
config.AppSettings.Settings.Add("ModificationDate", DateTime.Now.ToLongTimeString() + " ");
// Save the changes in App.config file.
config.Save(ConfigurationSaveMode.Modified);
but When I run the programme, I do not see any change in app.config under ther folder.
How could I change the value in app.config
I also use Using the MySettings Feature displayed in the article then I can store value even I restart the programme but I still do not see any changes in app.config.so where do programme store these values

About Write App.config
ChanKaiShi
Yes, that's what I meant.
If you're talking about changing initial values in your configuration file, you'll have to change them directly in the app.config, since there is no way you can change app.config file at runtime (it doesn't exist - it gets copied to appname.exe.config. If you want to persist your settings through debugging sessions, you can use a different mechanism - ApplicationSettings.
Andrej
PhilipDaniels
Hi,
app.config is the initial configuration file. When debugging, it's copied in the project's bin/debug folder, so at runtime, you're not writing to the project's app.config file, but its runtime config file [appname].exe.config...
Andrej
ronndu
I checked your code and it appears that using this method the config file that actualy gets written to [when running in VS IDE], is named [appname].vshost.exe.config. However, when executing the exe (outside of IDE), the application's config file correctly gets changed.
Andrej
Naolin
Yes, when you stop your debugging, the values in the .config file will become initial ones (the configuration is reset). This won't happen when you run your .exe outside the Visual Studio IDE.
Andrej
Sanchit Bahal
thanks .
I found the [appname].exe.config in /bin/debug folder. but I still do not see value which I changed in run-time store in it.So I want to know where the values be stored.
CoolTami
What's the meanning of outside the Visual Studio IDE
If I just direct run the progrmme uder /bin/debug folder, Is this outside the Visual Studio IDE I try it ,it's ok, the [appname].config is changed
If I want to debug programme with VS and need file changed evev I close the programme, How do I change my settings
Thanks
Freedom1029
Brad Corbett
thanks again
I have found every config file under the folder, include app.config, [appname].exe.config and [appname],vshost.exe.config. but there is still not any change in these files
evne I copy all files under the bin/debug folder to another computer and run it outside VS, but it's the same. programme can store values, but the config files listed above do not change
is this caused by vs settings
davidlt
What's the meanning of outside the Visual Studio IDE
If I just direct run the progrmme uder /bin/debug folder, Is this outside the Visual Studio IDE
aliasx
When programme is running, The code above changed [appname].vshost.exe.config.
but when cloing programming, the [appname].vshost.exe.config file become the initial one
so it looks does not change!
How to solve it