加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c# – 关于resources.ApplyResources的System.Resources.Missing

发布时间:2020-12-15 22:28:54 所属栏目:百科 来源:网络整理
导读:这是我正在努力的代码: System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EditorPane));this.editorControl = new EditorControl();resources.ApplyResources(this.editorControl,"
这是我正在努力的代码:

System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EditorPane));
this.editorControl = new EditorControl();
resources.ApplyResources(this.editorControl,"editorControl",CultureInfo.CurrentUICulture);

当代码执行时,它抛出一个’System.Resources.MissingManifestResourceException’,所有错误消息都只是吼叫.

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

Additional information: Could not find any resources appropriate for the specified culture or the neutral culture. Make sure “Editor.EditorPane.resources” was correctly embedded or linked into assembly “Editor” at compile time,or that all the satellite assemblies required are loadable and fully signed.

解决方法

对我来说,问题不是任何内部类定义.相反,问题源是在项目文件中,这花了我很长时间才发现.

这是我在项目文件中找到的:

<EmbeddedResource Include="Main.resx" />

这就是它必须:

<EmbeddedResource Include="Main.resx">
  <DependentUpon>Main.pas</DependentUpon>
</EmbeddedResource>

如果没有列出这种依赖关系(我必须强调,我没有自己删除它 – 它是在某个阶段由MS Visual Studio完成的),必要的资源文件没有在编译例程中正确包含.

我希望这会有所帮助(并让其他人头疼)!

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读