1

I found a free program on the web that was .NET 4.0, but had to copy over the code to compile VS2008. I'm thinking the way cultures is handled must be different in the versions of .NET. I'm getting this error:

System.Resources.MissingManifestResourceException: Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "A.B.C.Resources.ExceptionMessage.resources" was correctly embedded or linked into assembly "A.B.C.csproj" at compile time, or that all the satellite assemblies required are loadable and fully signed.

It's a C# .dll (class library), and I'm calling it from a Console Program. It does have a strong-key file assigned to it.

It's blowing up on any statement like this:

return ResourceManager.GetString("XYZ");

It looks like all the resources are in English, and that's the only language I need. I'm just looking for how to avoid the exception.

NealWalters
  • 17,197
  • 42
  • 141
  • 251
  • Did you copy the resources from the original project too? – svick Feb 13 '12 at 15:54
  • 1
    It sounds like the project solution is incomplete. This has nothing to do with .NET 4.0/3.0 because your conclusion is wrong the ResourceManager class did not change. Even if it did...It would still be supported. – Security Hound Feb 13 '12 at 15:58
  • Yes, I copied resource file and just now synced up the AssemblyInfo.cs file. Any hints as to what might be incomplete? – NealWalters Feb 13 '12 at 17:01

3 Answers3

3

When I copied over files, and rebuilt a new VS2008 project, there was no hierarchical relationship in Visual Studio Solution Explorer for the resource file. For example, ExceptionMessage.resx and ExceptionMessage.Designer.cs were at the same level; whereas normally the Designer.cs file is indented under the .resx file. I'm not sure what that happened.

So what I did was create a new .resx file, and carefully copy over using NotePad and filemerge programs, pieces of the .resx file and .cs file. Then it worked fine.

I'm still not absolutely sure what the problem was, but I know this fixed it. Lost about 5 hours today on this issue.

NealWalters
  • 17,197
  • 42
  • 141
  • 251
2

It might be worth to compare the [assembly: AssemblyCulture("")] properties in the assemblies from both your version 4 and version 3 solutions.

The default is - I think - none.

MSDN documentation:

Putting this attribute on an assembly and using something other than the empty string ("") for the culture name will make this assembly look like a satellite assembly, [...]

Perhaps you need to define it explicitly OR it already is defined but should not be?

Jens H
  • 4,590
  • 2
  • 25
  • 35
  • Both 4.0 and my version had not Culture there. From the MDSN page you posted, Looks like you only use AssemblyCulture when you have an assembly that only contains a resource, and no executable code. SO still no luck on my side. – NealWalters Feb 13 '12 at 16:59
0

I've had this difficulty and found that the cause had to do with Assembly name and Default namespace from project properties. It helps to set them both the same, or something to that effect.

beanmf
  • 493
  • 5
  • 7