By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,231 Members | 1,707 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,231 IT Pros & Developers. It's quick & easy.

Why dll assembly read AppSetting from its executable Config file

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
>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.