The situation:
- I have a class library, called
RT.Servers, containing a few resources (of typebyte[], but I don’t think that’s important) - The same class library contains a method which returns one of those resources
- I have a simple program (with a reference to that library) that only calls that single method
I get a MissingManifestResourceException with the following message:
Could not find any resources
appropriate for the specified culture
or the neutral culture. Make sure
“Servers.Resources.resources” was
correctly embedded or linked into
assembly “RT.Servers” at compile time,
or that all the satellite assemblies
required are loadable and fully
signed.
I have never played around with cultures, or with assembly signing, so I don’t know what’s going on here. Also, this works in another project which uses the same library. Any ideas?
All I needed to do to fix this problem was to right-click the
Resources.resxfile in the Solution Explorer and click Run Custom Tool. This re-generates the auto-generatedResources.Designer.csfile.If the .resx file was added to the project manually, the Custom Tool property of the file must be set to “ResXFileCodeGenerator”.
The problem is due to a mismatch of namespaces, which occurs if you change the “default namespace” of the assembly in the project settings. (I changed it from (previously)
"Servers"to (now)"RT.Servers".)In the auto-generated code in
Resources.Designer.cs, there is the following code:The literal string
"Servers.Resources"had to be changed to"RT.Servers.Resources". I did this manually, but running the custom tool would have equally well done it.