I want to compile *App_GlobalResources/Strings.resx* into my assembly (and eventually use satellite assemblies for Strings.es.resx, Strings.fr.resx, etc.) but the following error occurs once the app is published:
"Could not load file or assembly 'App_GlobalResources' or one of its dependencies. The system cannot find the file specified."
Steps to Reproduce:
- Create a new ASP.Net MVC project.
- Add an App_GlobalResources folder and a Strings.resx file.
- Set the file's build action to 'Embedded Resource'
- Add a string to Strings.resx and use it in
HomeController.Index()
, e.g.ViewData["Message"] = Strings.MyTest
- F5 to debug, works fine.
- Publish to IIS and (since Strings.resx is excluded from publishing) you will get the above error in the published site.
Can ASP.NET MVC projects use string resources compiled into the dll and if so, what am I doing wrong?
UPDATE: Here is what I see in Reflector:
So why is the ResourceManager not finding them? Isn't it supposed to fallback to the main assembly by default?