The situation:
RT.Servers
, containing a few resources (of type byte[]
, but I don't think that's important)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.resx
file in the Solution Explorer and click Run Custom Tool. This re-generates the auto-generated Resources.Designer.cs
file.
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:
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Servers.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
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.