Pregunta

I have a library loading the resources from an external file as follows:

ResourceManager rm = ResourceManager.CreateFileBasedResourceManager(stringsFileName, ResourcesDir, null)

Now I'd like to change the loading from external file to an embedded resource. I've attached a ".resources" file to the project, and changed its build action to "Embedded Resource". Loading it as follows:

   System.Resources.ResourceManager myManager = new
                   System.Resources.ResourceManager(resName,
                   myAssembly); 

This compiles fine. However, at runtime the application reports the following error:

Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "Strings.3.resources" was correctly embedded or linked into assembly "TestApp.Resources" at compile time, or that all the satellite assemblies required are loadable and fully signed.

This happens regardless of the name I pass, so my question is how to find the correct base name for the resource file I just embedded?

¿Fue útil?

Solución

I believe the resource name is fully qualified, so it would be {assemblyNameSpace}.Strings.3.resources.

You can confirm this by using a disassembler/decompiler like dotPeek: http://www.jetbrains.com/decompiler/

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top