Using ConfigurationManager cannot read config

8bit

New Member
I tried to use ConfigurationManager for the first time so thats what I did:1.) created a new Project (TestProject)2.) rightclick on TestProject -> Add -> New Item -> Application Configuration File (Name: Conf.config)3.) I edited the file so its looks like this:\[code\]<?xml version="1.0" encoding="utf-8" ?><configuration> <appSettings> <add key="key1" value="http://stackoverflow.com/questions/11430004/output1"/> <add key="key2" value="http://stackoverflow.com/questions/11430004/output2"/> <add key="key3" value="http://stackoverflow.com/questions/11430004/output3"/> </appSettings></configuration>\[/code\]Now If I try to read the config my code is telling me that its empty :/\[code\] NameValueCollection appSettings = ConfigurationManager.AppSettings; if (appSettings.Count == 0) //always true Console.WriteLine("something is wrong");\[/code\]Even if I try \[code\]ConfigurationManager.AppSettings["key1"]\[/code\] I dont get any output. Hm what am I doing wrong?
 
Back
Top