none
App. Config of the class library RRS feed

  • Question

  • Hello All, 

    Have a requirement which is as below 

    Need to prepare DLL which will perform some business funtionalities and this will be consumed by the other project / modules 

    prepared the DLL and also this will have some configurations which user might change . So i  have added the app.config to the DLL and  reading the values from there 

    Now when i have given this dll to the others , all the code which is reading the value of app.config is giving null value 

    So my question is this approach is wrong ? If yes, then what is the best way to provide the flexibility to this 

    If user gives the input the take that and if he is not given that then that it should read the default value from app.config 

    Friday, July 5, 2013 11:46 PM

Answers

  • Hi,

    is App.config present in your new project where you are trying to consume the dll's method?

    If present is the key/value present in that App.config file.

    Please check it once and try again.


    One good question is equivalent to ten best answers.


    • Edited by Shyam Kr Monday, July 8, 2013 6:09 AM spelling
    • Marked as answer by RajeshSql Wednesday, July 31, 2013 7:18 AM
    Monday, July 8, 2013 6:00 AM
  • An application configuration file should not be added to the class library project but to the application that is using the library. As each application might use the library with different settings, this makes perfect sense.

    Any calls to ConfigurationManager.AppSettings["..."] will check in the app.config of the client application and the app.config in the class library won't be used at all.

    Monday, July 8, 2013 8:07 AM

All replies

  • Hi,

    is App.config present in your new project where you are trying to consume the dll's method?

    If present is the key/value present in that App.config file.

    Please check it once and try again.


    One good question is equivalent to ten best answers.


    • Edited by Shyam Kr Monday, July 8, 2013 6:09 AM spelling
    • Marked as answer by RajeshSql Wednesday, July 31, 2013 7:18 AM
    Monday, July 8, 2013 6:00 AM
  • An application configuration file should not be added to the class library project but to the application that is using the library. As each application might use the library with different settings, this makes perfect sense.

    Any calls to ConfigurationManager.AppSettings["..."] will check in the app.config of the client application and the app.config in the class library won't be used at all.

    Monday, July 8, 2013 8:07 AM