I have a class library and my other projects are using it. And also i have some connection strings. i want to use them from just class lib’s App.config file. But when i use ConfigurationManager in my class lib for reading connection strings, program looks my current project’s App.config or Web.config files.
How can i use connection strings from class lib’s App.config file?
Thanks in advance
I think you need a Xml file in your class library. You should read your connection strings from it.
Copy them from the class lib’s config file to the application’s config file. See .Net app.config in library project
You have to provide a connection string in the end application.
Say you have a library.dll and application.exe
Classes in application.exe use library.dll. And classes in library.dll need connection string from App.config. Then you have to provide the connection string in App.config of your application.exe.