if you reference the AppSettings or ConfigurationSettings namespace from
within the dll and try to read a setting from the config file it will use
the one that is associated with the appdomin.

so regardless of whether this z.dll is referenced from a winform .exe or a
web app, it will use either the app.config or the web.config associated with
the applications entry point/launching assembly...unless the config file
name is explicitly overriden by manual construction of a new appdomain...etc

just remember to throw an exception if you cannot find the appsetting you
are looking for, so if you call into the dll from another .exe you are
reminded that you need the specific app setting.

-----Original Message-----
From: Discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] Behalf Of Knowlton,
Gerald F.
Sent: Friday, December 01, 2006 7:51 AM
To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
Subject: [ADVANCED-DOTNET] Using the app.config file


Good morning all,

I'm not sure how to best describe this situation, but here goes.

I have this application name "X" which calls a dll named "Y" which calls
a dll named "Z". All are 2005 .NET built.

What I wanted to do was be able to put some configuration values in the
app.config that is associated with "X" so that "Z" would be able to read
those configurations stored in X.App.Config file.

The only way I could see to be able to do that was to first create a
app.config file for "Z" then populate it with the values I would need
for that dll. I did this so I could compile "Z" with the
my.settings.<value> code.

I then took the same configuration names and values that I created in
"Z" and put them into the application "X" (which is two levels up in the
food chain). I thought a dll would always try to read the highest level
of app.config(it's parent parent configuration file) if one existed with
the values it needs. Apparently that is not true, or I have missed
something in the planning of this project.

My goal is to have the called dll read it's parent config file. Is this
possible?


Best regards,

Jerry Knowlton

===================================
This list is hosted by DevelopMentor.  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to