MissingManifestResourceException: Getting globalised values in cod

Discussion in 'ASP .Net' started by Marc Woolfson, Feb 6, 2008.

  1. 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, Feb 6, 2008
    #1
    1. Advertising

  2. 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");


    "Marc Woolfson" wrote:

    > 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, Feb 6, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?dmlrdG9yOTk5MA==?=

    error on the server when trying to run PowerPoint from asp.net cod

    =?Utf-8?B?dmlrdG9yOTk5MA==?=, Feb 28, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    2,073
    =?Utf-8?B?Q293Ym95IChHcmVnb3J5IEEuIEJlYW1lcikgLSBN
    Feb 28, 2005
  2. =?Utf-8?B?TmFtZXNwYWNl?=
    Replies:
    0
    Views:
    516
    =?Utf-8?B?TmFtZXNwYWNl?=
    Jun 1, 2005
  3. buran
    Replies:
    0
    Views:
    718
    buran
    Oct 31, 2005
  4. Nickolay

    executable from python cod

    Nickolay, Nov 24, 2004, in forum: Python
    Replies:
    7
    Views:
    413
    Nickolay
    Nov 27, 2004
  5. Jason
    Replies:
    0
    Views:
    121
    Jason
    Dec 8, 2005
Loading...

Share This Page