In my app.config i got something like:
<appSettings configSource="AppSettings.config"/>
I would have expected the application to read the settings dynamically from AppSettings.config but i doesn't...
Am i wrong here?
In my app.config i got something like:
<appSettings configSource="AppSettings.config"/>
I would have expected the application to read the settings dynamically from AppSettings.config but i doesn't...
Am i wrong here?
You are using the wrong attribute, use the file
attribute to reference an external configuration file:
<appSettings file="AppSettings.config"/>
app.config is read once at startup. Re-reading each time a config value is referenced could be a big performance hit. Besides, there are some entries like dependencies that it wouldn't make sense to change at runtime.
The Setting is correct. But as ctford said, this is only read once, when the application starts up... Is the file in the same folder as the application executable is being loaded from ? Also, in Visual Studio, where you have the file stored, right click on it, and verify that you have the Visual Studio File property "Copy to Output Directory" set appropriately. For files like this, the default is "Do Not Copy" and then the file will, duh, not be there when the app runs and looks for it...