I have recently migrated my MVC application from Visual Studio 2010 to Visual Studio 2012 and ever since then, whenever I’m adding a new line in any .resx file, the resource designer doesn’t get updated and I can’t access the newly created resource line via its corresponding property, in the code. All the other resource entries (created before the migration to VS 2012) are accessible.
I have recently migrated my MVC application from Visual Studio 2010 to Visual Studio
Share
After many attempts and a lot of time lost, I’ve managed to make it work. What I’ve done for every resource file, was to modify the Custom Tool to PublicResXFileCodeGenerator (from GlobalResourceProxyGenerator), modify the Build Action to Embedded Resource (from Content), modify the Custom Tool Namespace to something like MyWebAppNamespace.App_GlobalResources.
After the first 2 steps I was able to access resources by using the designerClass.ResourceKeyName property, but not by calling the designerClass.ResourceManager.GetString(“ResourceKeyName”), which was throwing an exception telling that my resource wasn’t found in the namespace MyWebAppNamespace.App_GlobalResources. This third step fixed all my problems even if I had to rename all the Resources namespace in my entire application.