Problem in reading configuration file from Class library project
- by Newbie
If I create an app.config file in a console apps like this
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key ="key1" value ="val1"/>
</appSettings>
</configuration>
and access the same from the console application like
object sourcePath = System.Configuration.ConfigurationManager.AppSettings["key1"];
or by
object sourcePath = System.Configuration.ConfigurationSettings.AppSettings["key1"];
I am able to get the value.
But if I do the same thing in a class library project, I am getting a null value. Why?
Where I am making mistake?
I have added the proper reference System.Configuration.
I am using C# 3.0