找不到类型或名称空间名称“ ContentBySearchWebPart”

时间:2019-02-13 12:29:48

标签: sharepoint office365 csom

enter image description here

最近,我试图在Visual Studio 2017中使用csom添加内容搜索Web部件,而我添加了“ ContentBySearchWebPart”类时,发生了以下错误: “找不到类型或名称空间名称“ ContentBySearchWebPart”(您缺少using指令还是程序集引用?)”。 甚至我都使用命名空间“ Microsoft.Office.Server.Search.WebControls ”和“ Microsoft.SharePoint.Client.Search ” dll。 我该如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

您需要从ISAPI文件夹或GAC手动添加引用“ Microsoft.Office.Server.Search.dll”

ISAPI文件夹

<Windows>\Program Files\Common Files\Microsoft Shared\Web Server Extenstions\16\ISAPI

GAC

(C:\windows\Windows.NET\assembly\GAC_MSIL\Microsoft.Office.Server.Search).

命名空间:Microsoft.Office.Server.Search.WebControls 程序集:Microsoft.Office.Server.Search(在Microsoft.Office.Server.Search.dll中)

https://social.msdn.microsoft.com/Forums/sharepoint/en-US/c6f03ea3-f893-4126-88e3-52a2a66b5f18/missing-assembly-reference-for-microsoftofficeserversearch?forum=sharepointdevelopmentprevious

检查\ Program Files \ Common Files \ Microsoft Shared \ Web服务器扩展\ 14 \ ISAPI,您会在此文件夹中找到更多DLL,包括您要查找的Microsoft.Office.Server.Search.dll。