Tawab Wakil
Tawab Wakil

Reputation: 2333

Exception when Restoring SharePoint 2010 Site Template

I am trying to restore a SharePoint 2010 site template (WSP) that I created. My method of restore is to create a new site and then apply this template to it through Central Admin. Halfway through the restore process (with the screen on "Processing..."), I get the following exception:

System.Runtime.InteropServices.COMException: <nativehr>0x8107058a</nativehr><nativestack></nativestack>Invalid URI: The URI scheme is not valid.

Digging into the SharePoint logs, it appears the exception is generated while activating a feature:

The element of type 'PropertyBag' for feature 'MySitePropertyBags' (id: d8c8ecfe-b8c4-42a9-87ca-a7e21eca5c58) threw an exception during activation: Invalid URI: The URI scheme is not valid. 2b46d061-e1f6-43f0-951d-d3a6252b0b77

I've tried multiple target machines, but no go. Any help?

EDIT: It is failing because of this line in the master page: <link href="<%$SPUrl:~SiteCollection/SiteAssets/css/styleSheet.css%>" type="text/css" rel="stylesheet"/>

I've tried changing ~SiteCollection to ~Site but it didn't help. Before anyone asks, yes, that CSS file exists. Any other ideas?

Upvotes: 1

Views: 1524

Answers (2)

Tawab Wakil
Tawab Wakil

Reputation: 2333

F. Aquino, thank you for your help. Your comments led me to the solution, which was to use the following line:

<SharePoint:CssRegistration name="<% $SPUrl:~Site/SiteAssets/css/styleSheet.css %>" After="corev4.css" runat="server"/>

Upvotes: 0

Francisco Aquino
Francisco Aquino

Reputation: 9127

You can't use $SPUrl directly in a non-server control, do it like this:

<link 
     href="<asp:Literal runat='server' Text='<%$SPUrl:~sitecollection/SiteAssets/css/styleSheet.css%>' />" 
     type="text/css" 
     rel="stylesheet" />

(Formatted to this small space)

Upvotes: 1

Related Questions