Can't read keys from App.config
app-config, c#, visual-studio-2012
Solution
I found the solution! The problem was, that I debugged a unit test, which was located in a different sub-project within the same solution. I copied the app.config file to the same project as the unit test and it works fine now. thanks for your help!
Problem
I want to read some values from my project's App.config file, but when I do this: ``` var appsettings = System.Configuration.ConfigurationManager.AppSettings; ``` I only get four entries: `StopTestRunCallTimeoutInSeconds`, `LogSizeLimitInMegs`, `CreateTraceListener` and `GetCollectorDataTimeout`, which aren't even listed in the XML. My keys `username` and `password` do not even appear. My App.Config looks like this: ``` <?xml version="1.0" encoding="utf-8"?> <configuration> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> </startup> <appSettings> <add key="username" value="Administrator" /> <add key="password" value="password" /> </appSettings> <system.web> <membership defaultProvider="ClientAuthenticationMembershipProvider"> <providers> <add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" /> </providers> </membership> <roleManager defaultProvider="ClientRoleProvider" enabled="true"> <providers> <add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" /> </providers> </roleManager> </system.web> </configuration> ``` Am I missing something? It seems to me like I was reading from a totally different config file, but there is no other one.