clr

clr

  • NA
  • 1
  • 0

Application configuration file for C# class library

Dec 27 2004 11:27 AM
Hi all, I'm building a library of C# classes to drive my website, and I'd like to keep a string in an application configuration file. In my class I'm using the following code... private string dbString = System.Configuration.ConfigurationSettings.AppSettings["fooKey"]; ...which is supposed to grab its value from the "[appname].config" file in my C# class library, which contains the following: However, when I step through the code using a test harness I see that my string value remains null after the line of code above is run. Any idea why this might be failing? I notice my [appname].config file isn't being copied to \bin\debug when I run the project, and I tried copying it there myself, but to no avail. I've also noticed that all the instructions I can find for working with app config files are for .exe projects or asp.net apps, not for class libraries -- I wonder if there's something one needs to do differently here? Thanks!

Answers (1)