accessing app.config file in class library
Hi,
I have a app.config file which resides in the windows application. I am trying to access the AppSettings of this config file in a class library project but I get null values. Windows application is using .NET remoting to make calls to this this class library (which is a data access layer). I would appreciate any help on this.
Thanks
[345 byte] By [
Vinod72] at [2007-12-17]
Class libraries use the same App.Config as one used by the executable.
So if you had a class library named Libray1 and an executable named MyApp, the Framework would look for a configuration file named: MyApp.exe.config.
Hi,
A class library always runs within the context of another hosting process which consumes it.
In this case, you would be having a .EXE that is acting as the Remoting host, such as Windows service or a Windows application. The .config file associated with the Remoting Host application will be accessible from the class library.
Note that the config file for Windows Service would need to be placed in the \WINDOWS\System32 folder.
Regards,
Vikram
I posted this comment in its ow thread:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=151892&SiteID=1&mode=1Is it possible to overwrite a class library setting using my remoting host .config file?
For example i have a data class library with a ConnectionString (i named it "DevelopmentConnection") defined in the class' properties.
Now i want my appllication to tell the data class library to use the string defined in my exe.config file (i called it to "DevelopmentConnection"). I can't get the data class library to use the new connection.
I do this, because i habe an application that runs on different customers. Each customer has its own Database Server with a different name each.
regards Oliver