472,983 Members | 2,509 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,983 software developers and data experts.

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:

\application.exe
\plugins\plugin1.dll
\plugins\plugin2.dll

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

\en\application.resource.dll
\fr\application.resource.dll

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

\plugins\en\plugin1.resource.dll
\plugins\en\plugin2.resource.dll
\plugins\fr\plugin1.resource.dll
\plugins\fr\plugin2.resource.dll

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

\en\plugin1.resource.dll
\en\plugin2.resource.dll
\fr\plugin1.resource.dll
\fr\plugin2.resource.dll

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
assembly).

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
application.plugin.resource.

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
ResourceManager.

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

Thanks

Nick

Nov 23 '06 #1
0 2275

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Sarah Woodfield | last post by:
Hi, I have written an application in VB.Net which runs well on my development PC. However on a few clients machines, at apparently random intervals, they get the above message and the programme...
0
by: thbst16 | last post by:
After a number of weeks of fruitless research and experimentation, I decided to turn to the group with this issue and see if anyone had any experiences or insights that might help me out. Here's...
4
by: Phil Da Lick! | last post by:
Hello, Got strings.resx included in my assmebly as the default language neutral collection. ResourceManager res=new ResourceManager("strings", Assembly.GetExecutingAssembly()); string...
2
by: franzhe | last post by:
Hi all, in a simple ASP.Net application with resources in satellite assemblies I have the following problem: If I set <identity impersonate="true"/>, accessing a culture specific resource...
4
by: BrianS | last post by:
What is the best strategy for dynamic loading private assemblies in asp.net? I understand, and have confirmed, that any dll placed in the app's /bin dir will get loaded on startup. This is not...
0
by: Rob Dob | last post by:
Hi, I have a VS2003 C# asp.net project that has been converted into a VS2005 project. Everything seemed to work well until I make a modification to anything within the Component Designer...
0
by: Nader | last post by:
I'm trying to use satellite assemblies in my web application. I got a problem with loading resource files. I have the falowing code: protected ResourceManager GetStrings = new...
1
by: Nader | last post by:
I have the next simple code and it doesn't work: ResourceManager gStrings = new ResourceManager("MyApp.Strings", Assembly.GetExecutingAssembly()); //Get the user's language. CultureInfo ci =...
1
by: =?Windows-1252?Q?Tor_B=E5dshaug?= | last post by:
BlankHi, I am having trouble loading assemblies from the database in my ASP.NET app. I have a default.aspx in my app that is served from a database via a custom virtual path provider. This works...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.