Careful with pre-requisite SharePoint Features

After a web designer applied a new master page to a site, he killed the site. We saw these messages (debug logging was enabled on the site)

Server Error in ‘/’ Application.

——————————————————————————–

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0030: Cannot convert type ‘Microsoft.SharePoint.WebControls.CssRegistration’ to ‘System.Web.UI.IAttributeAccessor’

Source Error:

Line 19: <link rel="stylesheet" type="text/css" href="/sites/pc/Style%20Library/my.css" mce_href="/sites/pc/Style%20Library/my.css"/>

Line 20: " __designer:Values="<P N=’InDesign’ T=’False’ /><P N=’ID’ T=’ctl01′ /><P N=’Page’ ID=’1′ /><P N=’TemplateControl’ ID=’2′ /><P N=’AppRelativeTemplateSourceDirectory’ R=’-1′ />"/>

Line 21:     <SharePoint:CssRegistration name="<% $SPUrl:~SiteCollection/Style Library/~language/Core Styles/Band.css%>" runat="server" __designer:Preview="<link rel="stylesheet" type="text/css" href="/sites/pc/Style%20Library/en-US/Core%20Styles/Band.css" mce_href="/sites/pc/Style%20Library/en-US/Core%20Styles/Band.css"/>

Line 22: " __designer:Values="<P N=’Name’ Bound=’True’ T=’SPUrl:~SiteCollection/Style Library/~language/Core Styles/Band.css’ /><P N=’InDesign’ T=’False’ /><P N=’ID’ T=’ctl02′ /><P N=’Page’ ID=’1′ /><P N=’TemplateControl’ ID=’2′ /><P N=’AppRelativeTemplateSourceDirectory’ R=’-1′ />"/>

Line 23:     <SharePoint:CssRegistration name="<% $SPUrl:~sitecollection/Style Library/~language/Core Styles/controls.css %>" runat="server" __designer:Preview="<link rel="stylesheet" type="text/css" href="/sites/pc/Style%20Library/en-US/Core%20Styles/controls.css" mce_href="/sites/pc/Style%20Library/en-US/Core%20Styles/controls.css"/>

Source File: /_catalogs/masterpage/Mydefault.master Line: 21

Here’s a similar error I saw..

Server Error in ‘/’ Application.

——————————————————————————–

Parser Error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Type ‘Microsoft.SharePoint.WebControls.DelegateControl’ does not have a public property named ‘SearchBoxEx’.

Source Error:

Line 38:     <SharePoint:DelegateControl runat="server"

Line 39:         ControlId="SmallSearchInputBox" Visible="False">

Line 40:         <WpNs0:SearchBoxEx runat="server" TitleLocIdNum="0″ DropDownMode="ShowDD" GoImageActiveUrlRTL="/_layouts/images/goRTL.gif" TitleLocId="Null" TextBeforeTextBox="" ScopeDisplayGroupName="Search Dropdown" AdvancedSearchPageURL="/searchcenter/Pages/Advanced.aspx" DescriptionLocIdNum="0″ AppQueryTerms="" FrameType="None" QueryPromptString="" GoImageActiveUrl="/_layouts/images/gosearch.gif" SuppressWebPartChrome="False" GoImageUrlRTL="/_layouts/images/goRTL.gif" ShouldTakeFocusIfEmpty="False" GoImageUrl="/_layouts/images/gosearch.gif" UseSiteDefaults="True" DropDownModeEx="ShowDD" DescriptionLocId="Null" AppQueryTermsLabel="" ExportMode="All" ChromeType="None" ShowAdvancedSearch="True" TextBeforeDropDown="" SearchResultPageURL="/searchcenter/Pages/Results.aspx" RegisterStyles="True">

Line 41:         <input runat="server" EnableViewState="False" value="http://asite" type="hidden">

Line 42:         </input>

Source File: /default.aspx Line: 40

And one more for good measure with the clincher..(if you check carefully it actually has a meaningful error message)

Server Error in ‘/’ Application.

——————————————————————————–

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0234: The type or namespace name ‘Publishing’ does not exist in the namespace ‘Microsoft.SharePoint’ (are you missing an assembly reference?)

Source Error:

[No relevant source lines]

Source File: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\36831729\da3a8eb\App_Web_999d82a0-fd08-4618-a707-bd83850f7eb6_-1117136529.nygwjb5c.0.cs Line: 1183

The root cause of all of three issues is that the new master page applied was built from the default master page (DEFAULT.MASTER – ie the designer took a copy of it and worked from that copy). However, these sites were originally built with the "SharePoint Publishing Infrastructure" site collection feature enabled. If you examine the default.master and compare with a publishing master page like blueglass.master you will see several differences.

Default.master

<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" [snip] <%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" [snip]] <%@ Register TagPrefix="wssuc" TagName="Welcome" [snip] <%@ Register TagPrefix="wssuc" TagName="DesignModeConsole" [snip]

Now compare with BlueGlassBand.master and note extra assembly declarations in bold.

<%@ Register Tagprefix="SPSWC" Namespace="Microsoft.SharePoint.Portal.WebControls" Assembly="Microsoft.SharePoint.Portal, [snip]
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" [snip]
<%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" [snip]
<%@ Register Tagprefix="PublishingWebControls" Namespace="Microsoft.SharePoint.Publishing.WebControls" [snip]
<%@ Register Tagprefix="PublishingNavigation" Namespace="Microsoft.SharePoint.Publishing.Navigation" [snip]
<%@ Register TagPrefix="wssuc" TagName="Welcome" [snip]
<%@ Register TagPrefix="wssuc" TagName="DesignModeConsole" [snip]
<%@ Register TagPrefix="PublishingVariations" TagName="VariationsLabelMenu" [snip]
<%@ Register Tagprefix="PublishingConsole" TagName="Console" [snip]
<%@ Register TagPrefix="PublishingSiteAction" TagName="SiteActionMenu" [snip]

I added these additional declarations to my customised master page and lo and behold, problems gone

4 Comments on “Careful with pre-requisite SharePoint Features

  1. Hello,

    I used a modified BlueGlass master page, not the default master, and received a similar error message:

    …Cannot convert type ‘Microsoft.SharePoint.WebControls.DelegateControl’ to ‘System.Web.UI.IAttributeAccessor’

    Any ideas on why this happens? Thanks.

    Terry

  2. rename the master file and excute iit
    once its worked
    restored to old name for the masterfile

  3. If you got the following error when browsing the page created in SharePoint Designer with a DataView

    Cannot convert type ‘Microsoft.SharePoint.WebControls.SPSqlDataSource’ to ‘System.Web.UI.IAttributeAccessor’

    You will need to check whether the DataFormWebPart is created within a webpart Zone.

    The solution would be insert the webpart zone first and then insert the dataview webpart within it.

    Tip: when you insert webpart zone or dataview, you will need to high light the area you want to insert in the Design view in SharePoint Designer

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.