467,910 Members | 1,660 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,910 developers. It's quick & easy.

Why dll assembly read AppSetting from its executable Config file

In my app, an executable (app.exe) calls functions from an assembly dll
(subapp.dll).

app.exe has config file: app.exe.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="configVal" value="exe config" />
</appSettings>
</configuration>

and subapp.dll.config has config file: subapp.dll.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="configVal" value="dll config" />
</appSettings>
</configuration>

When ran the app, the dll got setting from the exe's config file
instead of its own config file.

Can you tell why and how to fix it?

Thanks

Nov 16 '05 #1
  • viewed: 13676
Share:
2 Replies
Hi keith:

The config files are assigned per application domain, so this is the
expected behavior.

Mike Woodring has a sample that uses per-assembly config files:
http://www.bearcanyon.com/dotnet/#AssemblySettings

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Fri, 5 Nov 2004 10:38:02 -0800, "keith"
<ke***@discussions.microsoft.com> wrote:
In my app, an executable (app.exe) calls functions from an assembly dll
(subapp.dll).

app.exe has config file: app.exe.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="configVal" value="exe config" />
</appSettings>
</configuration>

and subapp.dll.config has config file: subapp.dll.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="configVal" value="dll config" />
</appSettings>
</configuration>

When ran the app, the dll got setting from the exe's config file
instead of its own config file.

Can you tell why and how to fix it?

Thanks


Nov 16 '05 #2
>In my app, an executable (app.exe) calls functions from an assembly dll
(subapp.dll).
app.exe has config file: app.exe.config
and subapp.dll.config has config file: subapp.dll.config
When ran the app, the dll got setting from the exe's config file
instead of its own config file.
Can you tell why and how to fix it?


Why? Because that's the way it was designed to work!

You can only "fix" it by supplying your own logic to parse and
interpret the sub-assembly's .config file - no native .NET classes or
support for that in the system, sorry.

Marc
================================================== ==============
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)inova.ch
Nov 16 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by V. Jenks | last post: by
3 posts views Thread by poppy | last post: by
12 posts views Thread by Steven Berkovitz | last post: by
4 posts views Thread by =?Utf-8?B?SmFu?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.