AppSettings problem

  • Thread starter Thread starter Eric Johannsen
  • Start date Start date
E

Eric Johannsen

We have a DLL that we're testing with NUnit (from GotDotNet). We want to
put some configuration information for the DLL into app.config in the
appSettings section. For some reason our settings are not being picked up.
We placed the appropriate XML tags in nunit-gui.exe.config (since NUnit is
loading our DLL), but ConfigurationSettings.AppSettings("ourTag") always
returns null.

Does anyone have any thoughts on why this is happening?

Is there a good tutorial that explains the details of .config files and how
the correct one is selected at runtime?

Thanks,

Eric
 
We have a DLL that we're testing with NUnit (from GotDotNet). We want to
put some configuration information for the DLL into app.config in the
appSettings section. For some reason our settings are not being picked up.
We placed the appropriate XML tags in nunit-gui.exe.config (since NUnit is
loading our DLL), but ConfigurationSettings.AppSettings("ourTag") always
returns null.
Does anyone have any thoughts on why this is happening?

Well, the basic out-of-the-box configuration support only extends to
applications as EXE's - it will pick up a "myapp.exe.config" file and
return values from it, but it WILL NOT look at a "mylib.dll.config"
file.

For that, you'd have to look elsewhere - there are a number of
third-party extensions / custom config readers that allow you to
specify the name of the config file to use.

Have a look here:
http://www.codeproject.com/csharp/Custom_Config_File_Reader.asp

and look around for other articles on CodeProject - excellent stuff.

Marc
================================================================
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)inova.ch
 
Thanks, just the info we are looking for.

Eric

Marc Scheuner said:
Well, the basic out-of-the-box configuration support only extends to
applications as EXE's - it will pick up a "myapp.exe.config" file and
return values from it, but it WILL NOT look at a "mylib.dll.config"
file.

For that, you'd have to look elsewhere - there are a number of
third-party extensions / custom config readers that allow you to
specify the name of the config file to use.

Have a look here:
http://www.codeproject.com/csharp/Custom_Config_File_Reader.asp

and look around for other articles on CodeProject - excellent stuff.

Marc
================================================================
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)inova.ch
 
Back
Top