Where to put App.config

W

WT

My web site is using a library created in a separate project.
VS 2005 has created for it an App.config file.
The library is included as a refernce in my web site.
When I copied my web site to it's destination the app.config has not been
copied by vs 2005. The library itself is in the bin directory.
Should I copy it manually and where to install it: in root file project or
in bin ?

Thanks for help
CS
 
G

Guest

CS,

App.Config files do not work with dll assemblies, only executables. Take the
entries from the app.config file and paste them into the appropriate sections
of your web.config and they will be avaiable to your app and any class
libraries that it uses.
Peter
 
S

Steven Cheng[MSFT]

Thanks for Peter's input.

Hi CS,

As Peter has mentioned, for .net application, the config file(app.config or
web.config) is only available at application level(winform ,console or
asp.net applications....). And the app.config file in Class library project
is just used to simulate the app.config or web.config file in concrete
application, so that we can convenient write code to accessing config file
elements or let the IDE conveniently generate some content for components
in app.config file.

When you want to reference a certain class library in your application, if
you need to also use those settings in the class library's app.config (or
update them), you need to copy the certain configuration sections in the
class librray's app.config into the concrete application's application
config file (app.config or web.config). Thus, when using in the
application, the class library will read those setting from the
application's app.config or web.config file...

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
W

WT

Thanks Peter and Steve for clear answer.
I was not used to this with VS2003 that was not automatically generating
app.config for dll assemblies.
CS
 

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

Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top