Jan 12 2012

SharePoint 2007 Error: The type or namespace name 'Publishing' does not exist in the namespace 'Microsoft.SharePoint' (are you missing an assembly reference?)

Category: ASP.NET | SharePointDavid @ 19:06

If your looking for the solution to the above error in SharePoint due to the use of the SPUrlExpressionBuilder (SPUrl) you will want to try a couple of things. The first is to include the following page declarations in the MasterPage if you have not already. 

<%@ Register Tagprefix="PublishingWebControls" Namespace="Microsoft.SharePoint.Publishing.WebControls" 
Assembly="Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral,
PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="PublishingNavigation" Namespace="Microsoft.SharePoint.Publishing.Navigation"
Assembly="Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral,
PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="PublishingVariations" TagName="VariationsLabelMenu"
src="~/_controltemplates/VariationsLabelMenu.ascx" %>
<%@ Register Tagprefix="PublishingConsole" TagName="Console" src="~/_controltemplates/PublishingConsole.ascx" %> <%@ Register TagPrefix="PublishingSiteAction" TagName="SiteActionMenu"
src="~/_controltemplates/PublishingActionMenu.ascx" %>

If you continue to get the above error you might be having the issue that I ran into where I was using the SPUrl inside of an ASP.NET User Control.  This has to do with the way that the User Control and MasterPage are parsed.  The User Control is parsed by ASP.NET first prior to the MasterPage.  This means that the declarations in the MasterPage are not present for the User Control.  The solution is to also include the above declarations in the markup for the User Control. Including the declarations in the User Control insures that the SPUrl tag prefix has been registered prior to the parsing of the expressions that use it.


    

Tags: ,

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading