By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,505 Members | 1,200 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,505 IT Pros & Developers. It's quick & easy.

using satellite assemblies, loading resource files

P: n/a
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?

Mar 13 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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
Mar 15 '07 #2

P: n/a
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
Mar 15 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.