using satellite assemblies, loading resource files

N

Nader

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
ResourceManager("StringsFallback", typeof(Satellite).Assembly);

This should load the resources stored in the StringsFallback assembly
file. Actually I don't realy know what exactly I should put at the
second argument...

And I get this error message:
The type or namespace name 'Satellite' could not be found (are you
missing a using dir....)

Can anyone help please?
 
D

D. Yates

Nader,

According to this:
ResourceManager GetStrings = new ResourceManager("StringsFallback",
typeof(Satellite).Assembly);


You are looking for something called StringsFallback.Resources in the same
assembly where the Satellite class lives.

There needs to be:
1. a class named "Satellite" in the assembly your after
2. the calling assembly, where the code snippet above lives, should have a
reference to the assmebly where the "Satellite" class lives


Dave
 
D

D. Yates

Nader,

You can also access a resource file using the following:

Here is an example of loading a resource file called MyResource.resx from a
satellite assembly called ClassLibrary. The namespace that the resource is
in is called ClassLibraryNS:

Assembly satAssembly = Assembly.Load("ClassLibrary");
ResourceManager rm = new ResourceManager("ClassLibraryNS.MyResource",
satAssembly);
string s = rm.GetString("String1");
MessageBox.Show(this, s);

See also:
http://www.sliver.com/dotnet/articles/resinweb.aspx


Dave
 

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