.net - ResourceManager 试图加载 .resources 而不是 .resx 文件

标签 .net resourcemanager

我正在尝试使用以下方法在我的 .net 网站中加载 resx 文件:

ResourceManager rm = new ResourceManager( "Project.Resource", Assembly.GetExecutingAssembly() );

Resource.resx 文件位于文件夹 App_LocalResources 中,并设置为在构建时嵌入到程序集中。

当我尝试使用以下方法访问 resx 文件时:
rm.GetString( "key" );rm.GetString( "key", culture );
我收到一条错误消息:

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



请注意 .resources ... 关于这里发生的事情的任何想法?

最佳答案

我认为您使用 ResourceManager 的方式是错误的。
看到这个 post .

另请注意,当您打开 Visual Studio 命令提示符并运行 resgen.exe 时,它​​表示它用于将资源文件从一种格式转换为另一种格式(即 resx 到资源)。
我认为,您需要将文件从 resx 转换为资源,然后使用 resourceManager 加载它。

关于.net - ResourceManager 试图加载 .resources 而不是 .resx 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1460981/

相关文章:

c# - 如何在编译后更改 AssemblyName 以在 Unity3d 中作为 mod 加载

c# - .net 中类和结构之间的实际区别(不是概念上的)?

javascript - .Net webApi ISO 日期时间和 IE8

c# - 需要从 C# 中的存储过程返回值

c# - 使用 BinaryFormatter 将自动实现的属性更改为正常和反序列化

c# - 在 ASP.NET MVC 应用程序中重写 ResourceManager?

c# - ResourceManager 没有选择正确的 resx 文件

c# - 持久资源管理器 (IEnlistmentNotification) 恢复

Objective-C:使用单例还是使用类作为对象?

hadoop - HDP 3.1.0.0-78升级后无法使用ResourceManager UI终止YARN应用