微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

这是我正在努力的代码

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 @R_688_4045@ion: 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完成的),必要的资源文件没有在编译例程中正确包含.

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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐