我收到此错误:找不到键为“描述”的资源对象。 但是当我将文字更改为: " /> 控件呈现得很好。 wss 资源文件有什么特别之处?如何使用内核-6ren">
gpt4 book ai didi

sharepoint - 为什么 $Resources :wss work in a web control, 但 $Resources :core does not?

转载 作者:行者123 更新时间:2023-12-03 16:36:25 26 4
gpt4 key购买 nike

当我的 ascx web 控件中有以下内容时:

<asp:Literal runat="server" Text="<%$Resources:core,Description%>" />

我收到此错误:找不到键为“描述”的资源对象。

但是当我将文字更改为:
<asp:Literal runat="server" Text="<%$Resources:wss,viewlsts_desc%>" />

控件呈现得很好。

wss 资源文件有什么特别之处?如何使用内核?

更新:

我仍然不知道为什么,但似乎 14\CONFIG\Resources 中的资源文件可用,而 14\Resources 中的文件不可用。

最佳答案

我强烈推荐 SharePoint Resources, Types, Use and Deployment这篇文章详细解释了 SharePoint 资源类型之间的差异。这是关于 SharePoint 2007,但我认为这方面没有任何变化(除了 14 是新的 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.

关于sharepoint - 为什么 $Resources :wss work in a web control, 但 $Resources :core does not?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3831951/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com