Friday, June 13, 2008

The type or namespace name 'Publishing' does not exist in the namespace 'Microsoft.SharePoint'

I started playing around with a copy of default.master yesterday and added in a CssRegistration link to the header:

<SharePoint:CssRegistration name="<% $SPUrl:~SiteCollection/Style Library/CustomMySiteRegistration.css %>" runat="server"/>

After deploying the master page to SharePoint i received the following error:

An error occurred during the processing of . c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\dff54803\4595fc0a\App_Web_custommysite.master_1096277560.2bgek7y-.0.cs(1389): error CS0234: The type or namespace name 'Publishing' does not exist in the namespace 'Microsoft.SharePoint' (are you missing an assembly reference?)

Thanks to Tom Meskens for posting the error here's the solution.
The default.master file doen't include the publishing assembly declarations required. They need to be added in as follows:

<%@ 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" %>


Republish the master page and hoorah - no more error!

No comments:

Post a Comment