In a previous post we saw how to create multi-language ASP.NET MVC sites by adding resource files.

In this post we´re going to see a common error that may pop up when using resource files in ASP.NET MVC.

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

The error message is not very helpful, although at least it is clear enough that the system is unable to find a resource file that we know is there. But don’t worry, this is a very simple bug to fix.

Let’s compare the file properties of these 2 resource files:

Resource file: incorrect configuration
Incorrect configuration
Resource file: correctly configured
Correct configuration

The system is able to find the Resources.resx file, but it cannot find the ValidationResources.resx although both of them are in the same project, and I added them to the same folder.

By looking at the images I posted of the File properties configuration for both files you can see what is wrong: the  build action for ValidationResources.resx is set  to Content, instead of to Embedded Resource as should be the case for resource files.

Therefore you need only to set the build action to Embedded Resource; now run the project again, and see the error message disappear :-).

Resources about the  build action property

In Visual Studio we can specify different types of build action depending on the type of file. Here are a couple of interesting links for those who want to learn more about the different available build actions: