I'm trying to access values from a resx resource file using HttpContext.GetGlobalResourceObject.
The resource file is in a folder called Resources and has the CustomTool property set to PublicResXFileCodeGenerator as per K. Scott Allen: http://odetocode.com/blogs/scott/archive/2009/07/16/resource-files-and-asp-net-mvc-projects.aspx
The resources are being built and embedded (I can see then in the assembly via ILSpy) and I can access the values in code using:
var b = MyApp.Resources.GlobalStrings.VendorUITitle;
But trying to access them via GetGlobalResourceObject always returns null
var s = HttpContext.GetGlobalResourceObject("MyApp.Resources.GlobalStrings", "VendorUITitle");
I was able to solve this problem by setting the Custom Tool of my resource file to be GlobalResourceProxyGenerator
And the Build Action to Content and Copy to Output Directory property to Copy Always
If I didn't do this then when I published to production calls to HttpContext.GetGlobalResourceObject would always return null.