470,620 Members | 1,413 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

Loading resources from satellite assemblies of reflection loaded assemblies..

Hi all,

This could get a bit complicated but I'll try to be as clear as
possible. I've written an application that discovers plugins at
runtime using reflection from a subdirectory of the application, eg:

In the directory the application is installed to:


I've successfully generated satellite assemblies for the main
application, these appear as (for example):


All is good so far. The plugins also have resources that need to be
localized, I expected their satellite assemblies to be required under:


However I find that my the ResourceManager class is trying to load them
from the same location as the application satellite assemblies:


I include some xml embedded in each plugin assembly so that the
application knows what classes it can create, the following is a
simplification of the loading code (this stuff is in the application

FileName = "\plugins\plugin1.dll"; // obviously this isn't hard coded
in the app.
_pluginAssembly = Assembly.LoadFile(FileName);

At this point the XML is loaded, part of this is the name of the
resources that your supposed to pass to the constructor of
ResourceManager. For example assuming the plugin has the namespace
application.plugin1 and the file is resource.resx the xml would contain

We then create the ResourceManager:

resName = "application.plugin1.resource";
ResourceManager rm = new ResourceManager(resName, _pluginAssembly);

And ask for a string

CultureInfo ci = new CultureInfo("fr");
String str = rm.GetString("string", ci);

this returns the string that is in plugin assembly (plugin1.dll) rather
than the satellite assembly no mater which culture I ask for. Using
SysInternal's filemon I see the application looking for
\fr\plugin1.resource.dll then \fr\plugin1.resource.exe. Obviously the
same occurs for dialogs, I assume
System.ComponentModel.ComponentResourceManager (used by default be the
IDE when you make a localizable dialog) is using the same rules as

Is there any way of getting resource from a subdirectory of \plugins\
rather then off of the base directory for those plugin resources?



Nov 23 '06 #1
0 2141

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Phil Da Lick! | last post: by
4 posts views Thread by BrianS | last post: by
1 post views Thread by =?Windows-1252?Q?Tor_B=E5dshaug?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.