Which config file?

  • Thread starter Thread starter Erik J Sawyer
  • Start date Start date
E

Erik J Sawyer

Is there any documentation on using config files with
multiple assemblies?

For example, I have a class library installed to the
GAC. This is then used in several ASPX pages. If the
class library requests settings from a config file, whose
will it get:
- the app.config that was built with the library (but
doesn't appear to have been installed to the GAC)
- the web.config of the calling application
or
- the machine.config file
???

Thanks,
Erik J Sawyer
 
Erik,

Because class libraries in .NET do not support built-in processing of the
dedicated .config files, the default behavior - as far as getting
application settings is concerned - is to get them from .config files of the
caller applications. It applies to all class libraries, not just the ones in
GAC. For example, if your library code retrieves an application setting, and
it is called from a Web application, the library will get the value from the
application's web.config file. If the same library is called by a Windows
application, the results will come from this application's .config file.

Alek
 
Back
Top