Could not find any resources appropriate for the specified culture or the neutral culture.

Posted by Captain Comic on Stack Overflow See other posts from Stack Overflow or by Captain Comic
Published on 2011-01-14T11:48:56Z Indexed on 2011/01/14 11:53 UTC
Read the original article Hit count: 166

Filed under:
|
|

I have created an assembly and later renamed it.

Then i started getting runtime errors when calling

toolsMenuName = resourceManager.GetString(resourceName);

The resourceName variable is "enTools" at runtime.

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

The code:

string resourceName;
ResourceManager resourceManager = new ResourceManager("Jfc.TFSAddIn.CommandBar", Assembly.GetExecutingAssembly());

CultureInfo cultureInfo = new CultureInfo(_applicationObject.LocaleID);

if(cultureInfo.TwoLetterISOLanguageName == "zh")
{
 System.Globalization.CultureInfo parentCultureInfo = cultureInfo.Parent;
 resourceName = String.Concat(parentCultureInfo.Name, "Tools");
}
else
{
 resourceName = String.Concat(cultureInfo.TwoLetterISOLanguageName, "Tools");
}

// EXCEPTION IS HERE
toolsMenuName = resourceManager.GetString(resourceName);

I can see the file CommandBar.resx included in the project, i can open it and can see the "enTools" string there.

© Stack Overflow or respective owner

Related posts about c#

Related posts about resources