c# - App.Config cannot access appSettings key/value pairs. The collection is always null -


i have app.config trying values out of , in solution executable. have compared output config.exe , visible. when try set these values, not show in collection.

<?xml version="1.0" encoding="utf-8" ?> <configuration>   <startup>     <supportedruntime version="v4.0" sku=".netframework,version=v4.5" />   </startup>   <appsettings>     <add key="a" value="b"/>   </appsettings> </configuration> 

i have tried can think of , have never had problem before. part of larger solution cannot show real values, have tested them in console project created , show fine. not sure why wouldn't show in particular solution. third party tools effect this?

i trying access them this:

using system.configuration; private readonly string stringtoset; public theconstructor()  {   stringtoset = configurationmanager.appsettings[key]; } 

update figured out reason, class library somehow hijacking app.config. solution referencing app.config thinks need keys .dll.config. how possible? project using config referencing in same project, not class library. how can happen?


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -