tl; dr Does strict code generation of the resource with normal (not built-in) resources in App_LocalResources ?
If not, why, and does the alternative of using embedded resources in satellite assemblies with implicit localization work?
The rest of this post simply explains where I am currently resolving these issues, feel free to ignore it if you know the answers.
When using implicit localization (syntax meta:resourceKey="Foo" ), I understand that I would have to write my own resource provider if you wanted to embed resources in satellite assemblies. The reason is that ASP.NET always uses the default provider for this and that this provider expects resx files in App_LocalResources , which can be obtained at run time. Also see this question , which has no answer at the time of this writing.
If this assumption is true, then it is not possible to use strongly typed generated classes (using ResXFileCodeGenerator ) without writing such a provider (which we would like to avoid), since the use of built-in resources is required to ensure code generation.
Since using generated types works fine for global resources, I want to ask a question about the second assumption:
- If I can generate strongly typed classes for global resources (in
App_GlobalResources using GlobalResourceProxyGenerator ) without embedding them in a satellite assembly ( Build Action set to Content as opposed to Embedded ), then Why can't I do the same for local resources? Why can't the generated code find and use resx files in App_LocalResources ?
Note: The exception that was thrown while trying to do this is a System.Resources.MissingManifestResourceException containing the following message:
Could not find resources suitable for the specified culture or neutral culture. Make sure "PROJECT.App_LocalResources.PAGE.aspx.resources" was correctly built-in or connected to the "PROJECT" assembly at compile time or that all necessary satellite assemblies are required to be downloadable and fully signed.
I know this message is misleading, as it explicitly searches for satellite assemblies instead of trying resx files (or that they compile at run time, App_LocalResources.dll , I think).
If there is a good reason why this is unacceptable (and therefore we have to use built-in resources in satellite assemblies), is there a good implementation of a resource provider that can look for resources in satellite assemblies when performing implicit localization? Of course, someone tried to do this before, and this does not seem to work as an application developer to solve this problem with plumbing.
As an additional question to the previous one, I also assume that when using the built-in resources in satellite assemblies, it would be impossible to put resx files in the App_* directories, since these are special directories used at runtime. Indeed, resx files are resx even deployed, so directories will be empty. Is this correct, and is there something that will pass as best practices in this regard?
I suppose another way to ResXFileCodeGenerator question is: can I make ResXFileCodeGenerator behave like GlobalResourceProxyGenerator when it comes to creating code that can load assemblies compiled by the runtime, as opposed to satellite collections compiled during assembly?