Last post Nov 27, 2017 06:20 AM by Cathy Zou
Nov 24, 2017 02:20 PM|neo_in_matrix|LINK
When I publish my website, I notice that the App_GlobalResources are compiled but App_LocalResources are not and copied directly to output folder. I wonder what's the reason behind this design. Thanks.
Nov 24, 2017 02:33 PM|PatriceSc|LINK
This is a web site or a web application project ? Precompiled or not ? I would have to test but my first thought is that this is because ASPX files could be compiled (and then you have placeholder files) or updatable directly on the server.
So if you can update an ASPX file, it makes sense that you can update as well the corresponding resource files on the fly. Check maybe what you have in the corresponding files (markup or a "this is a placeholder file" sentence).
Nov 24, 2017 02:43 PM|neo_in_matrix|LINK
It's a Web Site project, not a Web Application. Maybe it's a misunderstanding. I do not see App_GlobalResources in published folder, but only see App_LocalResources. That's why I come to the conclusion.
Now I see I set my website to be updatable and that explains why LocalResources are copied to output folder. But why GlobalResources are compiled? That does not make sense.
Nov 24, 2017 03:22 PM|PatriceSc|LINK
I'm not familiar with this model and would have to try. What if you search for a known resource string to see if you find this in a DLL (do you have any DLL ?) or maybe in generated source code ?
The "custom tool" settings for this file could also perhaps help to figure out what happens for this file.
Nov 24, 2017 04:10 PM|neo_in_matrix|LINK
I'm not asking a solution about a 'bug'. I want to know the reason behind the design why GlobalResources are so special compared to LocalResources.
Nov 24, 2017 04:21 PM|PatriceSc|LINK
global resources are always available as a strongly typed class. So it can make sense to consider them as code rather as data.
https://msdn.microsoft.com/en-us/library/ms229863.aspx you might have some obscure option to still keep resx files while still precompiling the site :
Files in the App_GlobalResources subdirectory
These files are compiled into assemblies and placed in the Bin directory. No App_GlobalResources subdirectory is created under the main output directory. If the configuration file specifies
appliesTo="All", .resx and .resources files are copied to the output directories. They are not copied if they are referenced by a
Nov 27, 2017 06:20 AM|Cathy Zou|LINK
Hi neo_in_matrix ,
Unlike the root App_GlobalResources folder, App_LocalResources folders can be in any folder in the application. You associate a set of resources files with a specific Web page by using the name of the resource file.
Accoding Table in official document that describes the different file types and the actions taken on them if the application is being precompiled for deployment and update.
For .resx files in the App_LocalResources folders, copies files as is to the App_LocalResources folder of the output location.