Reputation: 6817
In my mvc3 web project I have an App_GlobalResources folder containing the resource file Permissions.resx.
I am able to access the values in this file when I run the site locally in visual studio using:
string value = (string)HttpContext.GetGlobalResourceObject(resourceClass, key);
However, once I deploy it to the production web server it is not able to access the values in this file. I checked and it is creating App_GlobalResources in the bin folder of the publish directory containing the file.
My first time using global resource files, is there any additional steps required to get this working once deployed to the webserver?
Thanks.
Upvotes: 2
Views: 4447
Reputation: 42333
I'm pretty sure App_GlobalResources should not be created in the bin folder. Have you got Copy to output folder
set? (You shouldn't need it).
In WebForms, in properties of the .resx files, we have Build Action
set to Content
and Custom Tool
set to GlobalResourceProxyGenerator
. This creates dlls for the resources in the bin folder.
However, I've not used App_GlobalResources in MVC (it makes things tricky to test outside of a web context), but there's some info here that might be useful:
http://odetocode.com/Blogs/scott/archive/2009/07/16/resource-files-and-asp-net-mvc-projects.aspx
Upvotes: 3