When I have the following in my ascx web control:
<asp:Literal runat="server" Text="<%$Resources:core,Description%>" />
I get this error: The resource object 开发者_开发问答with key 'Description' was not found.
But when I change the Literal to:
<asp:Literal runat="server" Text="<%$Resources:wss,viewlsts_desc%>" />
The control renders just fine.
What's so special about the wss resource file? How can I use core?
Update:
I still don't know why, but it appears that resource files in 14\CONFIG\Resources are available, while files in 14\Resources are not.
I highly recommend SharePoint Resources, Types, Use and Deployment post which explains differences between SharePoint resource types in great detail. It's about SharePoint 2007, but I think nothing has changed in this area (except for the fact that 14 is the new 12).
The provisioning resources are located in the 12 hive in ..\12\Resources. In WSS the default provisioning resource file is core.resx. This file is used in site definitions (one.xml) files, features, list definitions etc.
[...]
Nevertheless the provisioning resource files are not accessible from the ASP.NET web sites. This is where the run-time resources come to play. These files are used in vanilla ASP.NET sites and are located in the web application folder under ..\wss\VirtualDirectories[port]\App_GlobalResources. They are compiled automatically by the .Net framework in the Resources namespace. These resources are available in assemblies and directly in ASPX pages. To access them from the code use the strongly-typed notation Resources.[file prefix].[resource name]. In ASPX pages use the explicit expression <%$ Resources:[filename prefix,]resource-key %>. The default WSS resource file in this category, used by all WSS sites, is wss.resx.
精彩评论