Pergunta

I'm trying to get some values from Resource. But each time it gives me the following error :

[MissingManifestResource_NoNeutralAsm] Arguments: FreakyBoss.Client.Resources.Language.resources,FreakyBoss.Client Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=5.0.60401.00&File=mscorlib.dll&Key=MissingManifestResource_NoNeutralAsm

My code is something like this :

    private readonly ResourceManager _resourceManager;
    public TranslationProvider() {
        _resourceManager = new ResourceManager("FreakyBoss.Client.Resources.Language", Assembly.GetExecutingAssembly());
    }
    public string GetResourceValue(string key) {
        return _resourceManager.GetString(key);
    }

My solution structure :

enter image description here

I don't know what's the problem. I've two resource files as you can see in the image above. I think there is a problem with BaseName argument of constructor in ResourceManager. But I don't know how should I fix this problem.

Any advice will be helpful.

Foi útil?

Solução

From my understanding you need to have a default resource and then add in the language specific resources. So in your case you would have (assuming en is default):

  • Language.resx
  • Language.fa.resx

The resource file already has all the code generated so you shouldn't have to write the code to generate the resource manager. Just access the Language.ResourceManager property.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top