找不到任何资源适合指定区域性或中性文化 [英] Could not find any resources appropriate for the specified culture or the neutral culture

查看:499
本文介绍了找不到任何资源适合指定区域性或中性文化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个ASP.NET Web项目(项目A和项目B)。当项目A类实例化类项目B的,它使用一个资源文件Blah.resx,我得到这个错误:

I have two ASP.NET Web projects (ProjectA and ProjectB). When class in ProjectA is instantiating a class of ProjectB which uses a resource file Blah.resx, I get this error:

型System.Resources.MissingManifestResourceException的一个例外,在mscorlib.dll中发生,但在用户code没有处理。

An exception of type 'System.Resources.MissingManifestResourceException' occurred in mscorlib.dll but was not handled in user code.

找不到任何资源适合指定区域性或中性文化。确保Resources.Blah.resources在编译时正确嵌入或链接到程序集​​App_GlobalResources.sn_flri6,或者确保所有需要的附属程序集都可加载并已进行了完全签名。

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

请告诉我造成的?

目前在微软的网站上有关此 http://support.microsoft.com/kb/318603 这提示:

There is an article on Microsoft's site about this http://support.microsoft.com/kb/318603 which suggests:

要解决此问题,移动所有其他类定义,以便它们在窗体的类定义后出现。

To resolve this problem, move all of the other class definitions so that they appear after the form's class definition.

这是Windows窗体项目的解决方案,我不知道如果这也适用于Web项目。

This is a solution for Windows Forms project, I'm not sure if that also applies to Web projects.

推荐答案

我只是打一个WPF项目同样的例外。我们最近搬到另一个命名空间的组件内发生的问题( ProblemAssembly.Support ProblemAssembly.Controls )。试图从存在于组件上的第二资源文件访问资源时,唯一的例外发生的事情。

I just hit this same exception in a WPF project. The issue occurred within an assembly that we recently moved to another namespace (ProblemAssembly.Support to ProblemAssembly.Controls). The exception was happening when trying to access resources from a second resource file that exists in the assembly.

打开了额外的资源文件没有正确地移动从旧的命名空间的名称引用到新的命名空间名称。

Turns out the additional resource file did not properly move references from the old namespace name to the new namespace name.

在designer.cs为资源文件,有一个静态的属性来获取的ResourceManager。在这一吸气剂,该字符串仍参照旧的命名空间。一旦修正到新的命名空间,这个问题就解决了​​:

In the designer.cs for the resource file, there is a static property to get the ResourceManager. Within that getter, the string was still referring the old namespace. Once correcting it to the new namespace, the problem was resolved:

global::System.Resources.ResourceManager temp = 
     new global::System.Resources.ResourceManager(
          "ProblemAssembly.Support.Properties.Stuff", typeof(Stuff).Assembly);

应该是:

global::System.Resources.ResourceManager temp = 
     new global::System.Resources.ResourceManager(
          "ProblemAssembly.Controls.Properties.Stuff", typeof(Stuff).Assembly);

希望这有助于在未来的人。

Hope this helps the next person.

这篇关于找不到任何资源适合指定区域性或中性文化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆