gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 01:37:27 25 4
gpt4 key购买 nike

我正在尝试使用以下方法在我的 .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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com