In my app, I have a web.config file with an appSettings section. The appSettings section contains a number of keys that the app uses. The appSettings section also contains the file="AppSettings.config"
attribute. The AppSettings.config file then contains a subset of the values from the main web.config. The idea is for the web.config to contain all the base/default settings, and then to provide overrides of the defaults in the AppSettings.config file.
According to this post (https://stackoverflow.com/a/6940086/216160), my setup ought to work (particularly : will merge (and override) settings in the .config file
).
The problem I'm seeing is that its not working. I have a default value of false, which then drives some logic about displaying some beta reporting functionality (or not), and have set the AppSettings.config to override this key to 'true'. Sadly, it continues to hide the report system. But, if I change the web.config value, then the item displays.
Is it possible that the AppSettings are not getting merged? How can I test/prove what's really happening?
EDIT
It appears that there was some kind of error in the AppSettings.config file. When all is working as it should, the merge happened exactly as expected. However, I still have the issue of how to detect when the AppSettings.config file has some kind of issue. I'd tested to see if the file was valid XML (and it was), but yet, some issue remained. When I copied the functioning key from web.config, and pasted it right below the non-working key from AppSettings.config, they appeared to be identical. I expect there must be some way to throw an error in the event of a config file merge error?