Could not find any resources for the specified cul

2019-04-26 15:42发布

问题:

I have to try to use internatinalization with this example.

http://afana.me/post/aspnet-mvc-internationalization-part-2.aspx

But I obtain this problem

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

I am looking for the solucion in google, but I dont understand the solucion.

I create my resources like this..

Right click on the Solution and then choose the "Add->New Project" context menu command. Choose "Class Library" project type and name it "Resources". Now right click on "Resources" project and then choose "Add->New Item" context menu command. Choose "Resource File" and name it "Resources.resx"

I read in other example that people create the resources in this file App_GlobalResources, this is relation with my error???

回答1:

I realise this is an old question, however in case it helps anyone else searching here >>>

You need to set the .resx build action to "Embedded resource" for it to work with Data Annotations as in that example. When you add a .resx to an App_LocalResources folder the build action will be set to Content by default.

Also, in your example above, you added it to another project, so ensure that the Access Modifier is also set to "Public" (double click the .resx file to open the file and the Access Modifier is located along the top of the editor window).

Also ensure that you add a reference to the resources project from your main application.