app.config file not read?

  • Thread starter Scott Graupmann
  • Start date
S

Scott Graupmann

I'm having trouble getting the settings out of my app.config file in a c#
project. I have put the file in the root of the project and in the bin
output directory with the name "app.config" and "<dllname>.dll.config" with
no luck. Every time I try to read from the config file I get the following
error:

"The key 'systemName' does not exist in the appSettings configuration
section."

where "systemName" is the first setting in the appsettings section. Any
ideas what I'm doing wrong, or what setting I managed to bork?

Thanks for any advise,
scott.
 
P

pesso

I don't think app.config is designed to work with DLLs like that.
Instead name the app.config after the executable that utilizes the DLL,
and the DLL should then be able to pick up the configuration from there.
 
S

Scott Graupmann

Thanks for the quick reply. As it happens I just figured out what was going
on. I'm using NUnit to test a Class Library and it has a setting I did not
know about that loads a file. Patched up the default value to one that
matched the .config file name and all is groovy now... at least until I
break something new... :)

Thanks,
scott.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top