Why dll assembly read AppSetting from its executable Config file

G

Guest

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
 
M

Marc Scheuner [MVP ADSI]

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
 

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

Top