Search code examples
c#.netweb-configclass-libraryconfigurationmanager

Cannot find ConfigurationManager in class library


So, I have a class library that I know will be used by websites and I need to access the config settings. I added a reference to System.Configuration, but I cannot find ConfigurationManager in the class library. A couple of things, one when I added a reference to the System.Configuration, it shows up as "System.configuration" with a lower case 'c', which I thought was odd. Another thing, when I access System.Configuration, the closest thing to ConfigurationManager is "ConfigurationSettings". I viewed the properties of the reference in a web app that allows me to use ConfigurationManager and this class library and they both point to the exact same file. Do I need to do this another way?

Here is a SS of my reference to it:

enter image description here


Solution

  • See https://msdn.microsoft.com/en-us/library/system.configuration.configurationmanager%28v=vs.100%29.aspx

    It lies in System.Configuration namespace and assembly System.Configuration. Make sure you go to Framework tab in Add references and select System.Configuration Screenshot of Add Reference tab in Visual Studio 2013