Art*_*ert 4 .net c# resources manifest visual-studio
这是我正在努力解决的代码:
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EditorPane));
this.editorControl = new EditorControl();
resources.ApplyResources(this.editorControl, "editorControl", CultureInfo.CurrentUICulture);
Run Code Online (Sandbox Code Playgroud)
当代码执行时,它会抛出“System.Resources.MissingManifestResourceException”,所有错误消息如下。
mscorlib.dll 中发生“System.Resources.MissingManifestResourceException”类型的异常,但未在用户代码中处理
附加信息:找不到任何适合指定文化或中立文化的资源。确保“Editor.EditorPane.resources”在编译时正确嵌入或链接到程序集“Editor”中,或者确保所需的所有附属程序集均可加载且已完全签名。
小智 5
对我来说,问题不在于任何内部类定义。相反,问题根源在项目文件中,这花了我相当长的时间才找到。
这是我在项目文件中找到的:
<EmbeddedResource Include="Main.resx" />
Run Code Online (Sandbox Code Playgroud)
这就是它必须的样子:
<EmbeddedResource Include="Main.resx">
<DependentUpon>Main.pas</DependentUpon>
</EmbeddedResource>
Run Code Online (Sandbox Code Playgroud)
如果此处未列出此依赖项(我必须强调,我自己没有删除它 - 它是由 MS Visual Studio 在某个阶段完成的),则必要的资源文件未正确包含在编译例程中。
我希望这会有所帮助(并避免其他人头痛)!
| 归档时间: |
|
| 查看次数: |
4208 次 |
| 最近记录: |