SharePoint 2013不能在沙盒解决方案中部署可视化web部件

本文关键字:部署 可视化 web 部件 解决方案 2013 不能 SharePoint | 更新日期: 2023-09-27 17:50:55

我正在尝试从sanbox解决方案部署一个可视化的webpart到SharePoint 2013网站。我的网页部分rss新闻。Ascx(它没有自定义代码):

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

当我尝试部署解决方案时,出现以下错误:

错误1字符字面量中字符太多RSSNews.ascx
错误2在类、结构或接口成员声明中无效的令牌'(' RSSNews.ascx
错误3方法必须有一个返回类型RSSNews.ascx
错误4}预期RSSNews.ascx错误5在类、结构或接口成员声明中无效的令牌'(' RSSNews.ascx错误6类、结构或接口成员声明中的令牌')'无效RSSNews.ascx
错误7命名空间不能直接包含字段或方法等成员RSSNews.ascx
错误8期望的类、委托、枚举、接口或结构RSSNews.ascx
错误9期望的类、委托、枚举、接口或结构RSSNews.ascx
错误10期望的类、委托、枚举、接口或结构RSSNews.ascx
错误11期望的类、委托、枚举、接口或结构RSSNews.ascx
错误12类型或命名空间定义,或文件结束RSSNews.ascx
错误13无效表达式term ')' RSSNews.ascx
错误14)预期RSSNews.ascx
错误15名称"InitializeControl"在当前上下文中不存在rssnews. asx .cs

Prasath C也有同样的问题,他说,在他将沙盒解决方案更改为false后,错误消失了。但我需要一个沙盒解决方案。

SharePoint 2013不能在沙盒解决方案中部署可视化web部件

原因是最后一个脚本引用:它有runat="server"属性。删除它并添加type="text/javascript"后,一切都很好!