Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / February 2008

Tip: Looking for answers? Try searching our database.

MissingManifestResourceException: Getting globalised values in cod

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Marc Woolfson - 06 Feb 2008 12:15 GMT
This has been driving me insane since the start of the month.

I am attempting to retrieve globalised values from resource files within a
C# ASP.NET web application in VS 2008 targeting .NET 3.5. I have added two
files to the App_GlobalResources directory:

  * WebUI.resx
  * WebUI.en-US.resx

both of which have corresponding .designer.cs files generated by the
GlobalResourceProxyGenerator tool. They both have a string entry called
MyString and 'Embedded Resource' has been set for their build action.

The default namespace and assembly name for the application is MyApp.WebUI,
but the .designer.cs files seem to ignore this and uses the namespace
Resources instead.

In the standard ASPX page, all is well when attempting to retrieve values
from the resource files but I am struggling to retrieve the same values
explicitly from code using the following:

  ResourceManager rm = new
ResourceManager(typeof(Resources.WebUI).ToString(),
Assembly.GetExecutingAssembly());
  string myLocalisedString = rm.GetString(Resources.WebUI.MyString);
 
I am receiving the following error on line 2:

  Could not find any resources appropriate for the specified culture or the
neutral culture. Make sure "Resources.WebUI.resources" was correctly embedded
or linked into assembly "MyApp.WebUI" at compile time, or that all the
satellite assemblies required are loadable and fully signed.

Using my favourite search engine to find a solution resulted in many
suggestions, but I cannot manage to get any of them to resolve the issue.
These include:

  * Renaming the resource files to match the default namespace (which
interestingly changes the namespace of the .designer.cs files to
Resources.Namespace rather then Namespace.Resources)
  * Removing and re-adding the resource files (oh, the joys of TFS source
control)
  * Using the full namespace to the resources in the ResourceManager
constructor (i.e. MyApp.WebUI.WebUI)
  * ...many others along the same lines as the above
 
Typically, the relevant MSDN pages/examples aren't very helpful either.
 
In my bin directory, I have the following (relevant) files:

  * bin/MyApp.WebUI.dll
  * bin/MyApp.WebUI.pdb
  * bin/en-US/MyApp.WebUI.resources.dll
 
When I open the bin/MyApp.WebUI.dll file in ildasm.exe I can see Resources >
Resources.WebUI > MyString etc. When I open
bin/en-US/MyApp.WebUI.resources.dll I can't see any entries which is because
the .designer.cs file seems to be empty [I have only just noticed this while
preparing this essay - is this a bug with .culture.resx files?].

Please can someone suggest what else I can try to attempt to resolve this
issue? I believe at least one of the items above is a bug in VS 2008, but am
sure there must be something else basic that I am doing wrong here.

Thanks in advance!

Marc
Marc Woolfson - 06 Feb 2008 14:51 GMT
Another forum helped me resolve this issue. The following code seems to work
fine:

ResourceManager rm = new
ResourceManager("MyApp.WebUI.App_GlobalResources.WebUI",
Assembly.GetExecutingAssembly());
           string myLocalisedString = rm.GetString("MyString");

> This has been driving me insane since the start of the month.
>
[quoted text clipped - 63 lines]
>
> Marc

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.