我正在使用由VS2008 Sharepoint模板(VSeWSS)生成的项目。目前,在使用ASCX文件时,IntelliSense无法识别导入的命名空间。我不知道该怎么做才能解决这个问题。智能感知不识别控件模板中的Sharepoint.WebControl元素
注意:每编辑下面,进口SharePoint.WebPartPages
工作正常,它只是SharePoint.WebControls
那不。
该项目的构建没有错误并正确部署。删除<%@Register Tagprefix="SharePoint"...
行后,部署后会出现预期的“未知服务器标记”SharePoint:SPGridView'“错误。
我发现了类似的问题(例如Unrecognized Tag Prefix or Device Filter in Visual Studio 2008),但问题及其答案仅涉及Web项目。他们特别提到了一个web.config
文件。某些不是作为SharePoint模板的一部分创建的。
建议的解决方法和原因,他们没有工作:
- 创建一个web.config文件 - 文件不存在这种类型的项目
- 的引用添加到DLL - 没有明显的影响
上固定该另外指示或建议将是受欢迎的。
<%@ Control Language="C#" AutoEventWireup="true"
Inherits="HelloWorld1.UserTableDoom, HelloWorld1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=2ace7ea1e94310d3" %>
<%@ Register Tagprefix="SharePoint"
Namespace="Microsoft.SharePoint.WebControls"
Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<SharePoint:SPGridView ID='fooGrid' runat='server'
AutoGenerateColumns='false'
DataKeyNames='user_id'
DataSourceID='foo'>
...
</SharePoint:SPGridView>
编辑: 有趣的是,我可以添加WebPartPages
命名空间,我把它正常工作在智能感知。
我还注意到,当创建一个全新的解决方案并将ASCX文件放入其中时。问题依然存在。 SharePoint.WebPartPages的作品,但SharePoint.WebControls没有。
<%@ Register Tagprefix="WebPartPages"
Namespace="Microsoft.SharePoint.WebPartPages"
Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<WebPartPages:...> -- works correctly.
什么是您使用的“VS2008 Sharepoint模板”?从VSeWSS? – 2009-09-18 12:51:41
是的,VSeWSS模板(傻15分钟)。 – Danny 2009-09-18 14:34:08