ASP.NET 2.0 Resource Satellite Assemblies (Bug?)

G

gjenglish

I have recently migrated an ASP.NET 1.1 web application to ASP.NET 2.0.
In this application I am storing all my resources in satellite
assemblies and I am accessing them via the ResourceManager object.

However, the ResourceManager is no longer returning the resources from
the satellite assemblies; it appears that it is always using the
fallback resource assembly (neutral); which in my case is the resource
assembly that is embedded in the main assembly.

The odd thing is that when I view the ResourceManager in the watch
window, I can see that it has found my satellite assesmblies (French
Canadian - fr-CA) and I can access the satellite assembly via
GetSatelliteAssembly() method of the executing assembly.

- ResourceSets Count = 3 System.Collections.Hashtable
+ [{}] {System.Resources.RuntimeResourceSet}
+ [{fr-CA}] {System.Resources.RuntimeResourceSet}
+ [{fr}] {System.Resources.RuntimeResourceSet}
+ Raw View

As, well, I can get the satellite assembly via the
GetSatelliteAssembly() method. I don't want to use this method because
it doesn't incorporate the fallback mechanism:

ResourceManager rm = new ResourceManager("Namespace.ResourceFileName",
Assembly.GetExecutingAssembly().GetSatelliteAssembly(new
CultureInfo("fr-CA")));
string test = rm.GetString("StringKey");


However, I cannot access the satellite assembly by doing the following:

ResourceManager rm = new ResourceManager("Namespace.ResourceFileName",
Assembly.GetExecutingAssembly());
string test = rm.GetString("StringKey", new CultureInfo("fr-CA") );

Is this a bug is 2.0? Does anyone have a solution for this? I would
still like to use satellite assemblies and not the new Local and Global
resource feature in 2.0.

Thanks in advance for your help, it is much appreciated

Garry
 
J

Jim Cheshire

gjenglish said:
I have recently migrated an ASP.NET 1.1 web application to ASP.NET
2.0. In this application I am storing all my resources in satellite
assemblies and I am accessing them via the ResourceManager object.

Does it work if you replace GetString with GetLocalResourceObject?
 
G

Garry English

Thank you Jim for your reply.

GetLocalResourceObject method gets a page level resource. These
resources are located in the App_LocalResources folder in an ASP.NET
application.

I am having a problem with resource satellite assemblies, which are not
stored in the App_LocalResources folder. Please let me know if my
previous posting isn't clear enough.

Thanks,

Garry
 
G

Garry English

I have found a work around for this issue.

Instead of including the .resource files to the class library project,
I included the .resx files. VS.NET will still compile the .resx to the
binary .resource file and build the satellite assemblies.

It appears that VS.NET can't build satellite assemblies from .resource
files any more. Is this a bug?
 

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

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top