Reading App.config to get the value based on key in c# library project -


i trying read setting app.config , looks below

    <?xml version="1.0" encoding="utf-8" ?> <configuration>   <appsettings>     <add key="chrome" value="path chrome driver" />     <add key="ie32" value="path ie32 driver" />     <add key="ie64" value="path ie64 driver" />     <add key="url" value="url site"/>   </appsettings> </configuration> 

i using following code read content

using system; using system.configuration; public static class config       {         public static string clientid                 {                     { return configurationmanager.appsettings["ie32"]; }                 }         } 

why return null?

how many projects have?

i suspect have 2 projects (or more) app.config needs in project being run not project config class.

also when build project if console app or windows app bin directory should contain .config file same name exe. in web app in root of app in file called. web.config.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -