HighTechTalks DotNet Forums  

Configuration Section not loading with dynamically loaded Assembly

Dotnet General Discussions microsoft.public.dotnet.general


Discuss Configuration Section not loading with dynamically loaded Assembly in the Dotnet General Discussions forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Paul Buckley
 
Posts: n/a

Default Configuration Section not loading with dynamically loaded Assembly - 01-02-2008 , 09:05 AM






Hi,

I'm trying to gain access to a configuration section from within an
assembly that has been loaded using Assemly.Load(byte[]).

There is one main exe (lets say myApp.exe) and one config file
(myApp.exe.config) which contains the config section. The dll
(myAssembly.dll) is a "plugin" and loaded on request. The reason we
use the byte array version of Assembly.Load is that the dll can remain
unlocked which allows us to overwrite it (and update the plugin with a
new version via a file watcher without taking down the service).

I have tried
ConfigurationManager.OpenExeConfiguration(Configur ationUserLevel.None)
and also the same method but passing in a full path to the config
file. Both return a Configuration object that does not contain my
custom config section so a call to GetSection returns null.

If we load the Assembly using Assembly.Load(string) then everything
works perfectly, but the Assembly file is locked and can't be updated.

Can anyone help me with why these two Load methods result in such
different behaviour, and what the solution might be to get round it?

Currently I am just using "AppSettings" but this is not as clean as
having individual config sections.

Thanks!

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.