I have a problem using a dll with a service reference that should read a custom configfile.
My situation is as follows: - DLL which read its own config file (by using configurationManager.openExeConfiguration(dllname.dll.config)) - main application which uses the DLL (3d-party application)
This is working fine, the dll reads the right configsettings.
Now I must add a service-reference to my DLL. The problem is that it tries to read the standard app.config file (which doesn't exist), instead of reading the dllname.dll.config file.
Anyone has a solution for this?
Thanks,
In .NET, it has never been the intention that libraries should have their own .config files, so there's no official support of this and lots of issues are sure to abound.
Although you can read such a file with ConfigurationManager.OpenExeConfiguration, this was never the intention of that API - it's mainly there to provide an API for editing application .config files.
You would be much better off if you let the library read from the app.config file instead, using the standard ConfigurationManager API. You can still have custom sections for your library in the app.config file. This is the way it was always intended to work, and it will give you far less trouble.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With