Problem reading config file from class library project
If I create a file app.config
in console applications like
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key ="key1" value ="val1"/>
</appSettings>
</configuration>
and access the same from a console application like
object sourcePath = System.Configuration.ConfigurationManager.AppSettings["key1"];
or
object sourcePath = System.Configuration.ConfigurationSettings.AppSettings["key1"];
I can get the value.
But if I do the same in a class library project, I get a null value. What for? Where am I going wrong? I have added the correct link System.Configuration
. I am using C # 3.0
+2
a source to share