Getting “Could not find any resources “error while using some resource files to make the internationalization of a ASP.NET application
If you getting this error “Could not find any resources appropriate for the specified culture (or the neutral culture) in the given assembly. Make sure …” while trying to load Resources using ResourceManager from multi language assemblies it’s usually caused by loading the Resource file with this code:
<code>
ResourceManager resources = new ResourceManager(
"<ResName>",
Assembly.GetExecutingAssembly(),
null );
</code>
While this code is suggested by MSDN : http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemResourcesResourceManagerClassctorTopic4.asp, it’s missing the <WebProjectName>. So it should be like this:
ResourceManager resources = new ResourceManager(
"<WebProjectName>.<ResName>",
Assembly.GetExecutingAssembly(),
null );
Where the resx files are named: <ResName>.<Culture>.resx
It’s also recommended to create only a single instance of the ResourceManager for your web app and to keep ResourceManager in a static class member or the Application object. This causes the resources to be loaded only once per application.