Stupid App.Config Question

D

Dave

I have a client app as one project and a data access class
library as another project. I have put app.config files
everywhere and named them everything. If I name it
MyApp.exe.config and put it in the client's bin directory,
the client can get to it but I can't make the data access
assembly access it.

Any Ideas?

Thanks
 
M

Martin Robins

By default, if you use the configuration namespace within a DLL it will look
for the App.config of the application using the DLL.
 
M

Marc Scheuner [MVP ADSI]

I have a client app as one project and a data access class
library as another project. I have put app.config files
everywhere and named them everything. If I name it
MyApp.exe.config and put it in the client's bin directory,
the client can get to it but I can't make the data access
assembly access it.

Well, basically, assemblies (DLL's) don't support reading their own
app config files out of the box - they'll always try to revert to the
config file of the app calling them.

You'd have to work around this by using some kind of a third-party
config reader, which allows you to specify exactly which config file
you want to inspect / evaluate.

Check out this component as a sample - there are a few more out there:

http://www.codeproject.com/csharp/Custom_Config_File_Reader.asp

Marc
================================================================
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)inova.ch
 

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

Similar Threads

VS 2005 publish and app.config encryption problem 2
app.config file 6
app.config 2
App.config 4
accessing connection string in data access layer 2
PropertyGrid and app.config 0
app.config 2
App.Config File 2

Top