Reading app.config from a .DLL

  • Thread starter Thread starter Waldy
  • Start date Start date
W

Waldy

Hi there,
I added an app.config file to a .DLL project, but the code
does not read the values from it. I understand that these files are
intended for executables rather than .dlls. What is the standard approach
to this problem?
 
Hello Waldy,

Standard approach is to use System.Xml namespace and read elements directly

W> Hi there,
W> I added an app.config file to a .DLL project, but the
W> code
W> does not read the values from it. I understand that these files are
W> intended for executables rather than .dlls. What is the standard
W> approach to this problem?
W>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 
Waldy,

A dll connot run on its own. It will be used by an executable. If the
required settings from your app.confi file are in the config file of the
executable, then everything will work as expected.

Of course when creating the executable, you have to know which settings are
required in the config file for the dll to work. Maybe you could return an
error message that describes the required setting if it is not found, so that
the developer of the executable will know what to put in his app.config.

Hope this helps,

Joris
 
Joris Zwaenepoel said:
Waldy,

A dll connot run on its own. It will be used by an executable. If the
required settings from your app.confi file are in the config file of the
executable, then everything will work as expected.

The .DLL will be executed by VB Script, so it will not have an executable
with it. I added an app.config file to the .DLL project, but it does not
work. No error occurs, but the values are not read in.
 
Back
Top