这是我正在努力解决的代码:
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EditorPane));
this.editorControl = new EditorControl();
resources.ApplyResources(this.editorControl, "editorControl", CultureInfo.CurrentUICulture);
当代码执行时,它会抛出“System.Resources.MissingManifestResourceException”,所有错误消息如下。
mscorlib.dll 中发生“System.Resources.MissingManifestResourceException”类型的异常,但未在用户代码中处理
附加信息:找不到任何适合指定文化或中立文化的资源。确保“Editor.EditorPane.resources”在编译时正确嵌入或链接到程序集“Editor”中,或者所需的所有附属程序集均可加载并完全签名。
对我来说,问题不在于任何内部类定义。相反,问题根源在项目文件中,这花了我相当长的时间才找到。
这是我在项目文件中找到的:
<EmbeddedResource Include="Main.resx" />
这就是它必须的样子:
<EmbeddedResource Include="Main.resx">
<DependentUpon>Main.pas</DependentUpon>
</EmbeddedResource>
如果此处未列出此依赖项(我必须强调,我自己没有删除它 - 它是由 MS Visual Studio 在某个阶段完成的),则必要的资源文件未正确包含在编译例程中。
我希望这有帮助(并让其他人免于一些头痛)!
美好的一天 我有类似的问题,但我不太明白解决方案。 您在哪个文件中进行了更改?