我正在SharePoint 2010中构建Web部件,并且需要使用TaxonomyFieldControl进行过滤。我已经在项目中设置了引用(不是'intl',v14.0.0.0的引用),但是我收到警告:“元素'TaxonomyFieldControl'不是已知元素。如果出现编译错误,则会发生此情况。网站上的文件,或者缺少web.config文件。”在编译时,在运行时,我得到“未知的服务器标签'Taxonomy:TaxonomyFieldControl'”

<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="Taxonomy" Namespace="Microsoft.SharePoint.Taxonomy" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WebPart_DocumentsUserControl.ascx.cs" Inherits="Test.WebPart_Documents.WebPart_DocumentsUserControl" %>
...
<Taxonomy:TaxonomyFieldControl FieldName="TaxonomyFilter" runat="server"></Taxonomy:TaxonomyFieldControl>


还应注意的是,“分类”未随Intellisense一起出现,“实用程序”也未出现,其余都没有。同样在后面的代码中,我有:

using Microsoft.SharePoint.Taxonomy;


并且可以编译。

我尝试按照http://blog.tentaclesoftware.com/archive/2010/07/21/95.aspx删除架构缓存

谢谢!

最佳答案

您正在注册错误的程序集。代替:

<%@ Register TagPrefix="Taxonomy" Namespace="Microsoft.SharePoint.Taxonomy"
             Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral,
                       PublicKeyToken=71e9bce111e9429c" %>


尝试:

<%@ Register TagPrefix="Taxonomy" Namespace="Microsoft.SharePoint.Taxonomy"
             Assembly="Microsoft.SharePoint.Taxonomy, Version=14.0.0.0, Culture=neutral,
                       PublicKeyToken=71e9bce111e9429c" %>

10-06 02:42