I am working with a project generated by the VS2008 Sharepoint template (VSeWSS). Currently, when working in the ASCX files that I have, IntelliSense does not recognize the imported namespaces. I'm uncertain what to do to address this.
Note: Per edit below, importing SharePoint.WebPartPages
works fine, it's just SharePoint.WebControls
that doesn't.
The project does build without error and deploys correctly. Removing the <%@Register Tagprefix="SharePoint"...
line results in the expected "Unknown server tag 'SharePoint:SPGridView'" error once deployed.
I have found similar questions (ex. Unrecognized Tag Prefix or Device Filter in Visual Studio 2008) however, the question and its answers refer only to web projects. In particular they speak of a web.config
file. Something that is not created as part of the SharePoint template.
Suggested solutions and reasons they didn't work:
- Create a web.config file -- File does not exist in this type of project
- Add a reference to the dll -- No apparent effect
Further directions or suggestions on fixing this would be welcome.
<%@ 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>
Edit:
Interestingly enough, I can add the WebPartPages
namespace and I it works correctly in IntelliSense.
I have also noted that when creating an entirely new solution and placing the ASCX file in it. The problem still exists. The SharePoint.WebPartPages works but SharePoint.WebControls does not.
<%@ Register Tagprefix="WebPartPages"
Namespace="Microsoft.SharePoint.WebPartPages"
Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<WebPartPages:...> -- works correctly.