Question

In order to have neater app distribution I have made app.config file to be embedded 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

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top