Which config file?

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
 
A

Alek Davis

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top