Arthur Coudert
Arthur Coudert

Reputation: 79

System.Resources.MissingManifestResourceException on resources.ApplyResources

Here is the code i'm struggling with:

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

when the code is executing, it's throw a 'System.Resources.MissingManifestResourceException' the all error message is just bellow.

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.

Upvotes: 4

Views: 4780

Answers (1)

ikue
ikue

Reputation: 61

For me, the problem was not any internal class definition. Instead, the problem source was in the project file, which took me quite some time to find out.

This is what I found in the project file:

<EmbeddedResource Include="Main.resx" />

And this is what it has to be:

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

If this dependency is not listed there (and I have to underline, I did not remove it myself - it was done at some stage by MS Visual Studio), the necessary resource file is not included properly in the compilation routine.

I hope this helps (and saves others some headache)!

Upvotes: 6

Related Questions