Reputation: 56
I'm trying to deploy a visual webpart to SharePoint 2013 site from sanboxed solution. My webpart RSSNews.ascx (it doesn't have custom code behind):
<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="RSSNews.ascx.cs" Inherits="Solution.WebParts.RSSNews.RSSNews" %>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("feeds", "1")
</script>
<script src="/SiteAssets/feeds.js" runat="server" ></script>
<div id="feeds">
</div>
When I try to deploy the solution the following errors occur:
Error 1 Too many characters in character literal RSSNews.ascx
Error 2 Invalid token '(' in class, struct, or interface member declaration RSSNews.ascx
Error 3 Method must have a return type RSSNews.ascx
Error 4 } expected RSSNews.ascx
Error 5 Invalid token '(' in class, struct, or interface member declaration RSSNews.ascx
Error 6 Invalid token ')' in class, struct, or interface member declaration RSSNews.ascx
Error 7 A namespace cannot directly contain members such as fields or methods RSSNews.ascx
Error 8 Expected class, delegate, enum, interface, or struct RSSNews.ascx
Error 9 Expected class, delegate, enum, interface, or struct RSSNews.ascx
Error 10 Expected class, delegate, enum, interface, or struct RSSNews.ascx
Error 11 Expected class, delegate, enum, interface, or struct RSSNews.ascx
Error 12 Type or namespace definition, or end-of-file expected RSSNews.ascx
Error 13 Invalid expression term ')' RSSNews.ascx
Error 14 ) expected RSSNews.ascx
Error 15 The name 'InitializeControl' does not exist in the current context rssnews.ascx.cs
Prasath C had the same problem and he says that after he changed Sandboxed Solution to false the errors disappeared. But I need a sandboxed solution. Any help would be appreciated.
Upvotes: 0
Views: 537
Reputation: 56
As it turned out the cause was the last script reference: it had runat="server" attribute. After removing it and adding type="text/javascript" everything works fine!
Upvotes: 1