Embedding app.config: working only in release, not in debug
In order to have neater app distribution I have made app.config file to be em开发者_C百科bedded resource, since it only contains default values. However, the app now cannot be debugged, it throws an exception (ConfigurationErrorException
). But when released, the app runs fine. Is there any way how to get it working in the debug time too? Thanks
I hope you are aware of the fact that this is not the intended behaviour? How do you extract the app.config at runtime? How do you get the values from the settings? The app.config file is not distributed as "app.config", but as "yourprogramname.exe.config". Which one do you embed?
If you embed the config file, you have no way of changing values. Why do you use the config file instead of hardcoding the values?
When you say that the app runs fine when you release-build it: I'm pretty sure that the values are not taken from the config file, but from the default values of the Settings class.
To make a long story short: I doubt that your approach will work.
精彩评论