我尝试使用VS 2013将jquery scrollTo.js添加到我的包中。
我已将其添加到Site.Master上的脚本管理器
<asp:ScriptManager runat="server">
<Scripts>
<%--To learn more about bundling scripts in ScriptManager see http://go.microsoft.com/fwlink/?LinkID=272931&clcid=0x409 --%>
<%--Framework Scripts--%>
<asp:ScriptReference Name="MsAjaxBundle" />
<asp:ScriptReference Name="jquery" />
<asp:ScriptReference Name="jquery.ui.combined" />
<asp:ScriptReference Name="WebForms.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebForms.js" />
<asp:ScriptReference Name="WebUIValidation.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebUIValidation.js" />
<asp:ScriptReference Name="MenuStandards.js" Assembly="System.Web" Path="~/Scripts/WebForms/MenuStandards.js" />
<asp:ScriptReference Name="GridView.js" Assembly="System.Web" Path="~/Scripts/WebForms/GridView.js" />
<asp:ScriptReference Name="DetailsView.js" Assembly="System.Web" Path="~/Scripts/WebForms/DetailsView.js" />
<asp:ScriptReference Name="TreeView.js" Assembly="System.Web" Path="~/Scripts/WebForms/TreeView.js" />
<asp:ScriptReference Name="WebParts.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebParts.js" />
<asp:ScriptReference Name="Focus.js" Assembly="System.Web" Path="~/Scripts/WebForms/Focus.js" />
<asp:ScriptReference Name="WebFormsBundle" />
<asp:ScriptReference Name="scrollTo.js" Assembly="System.Web" Path="~/Scripts/scrollTo.js" />
<%--Site Scripts--%>
</Scripts>
</asp:ScriptManager>
在BundleConfig.c中我添加了
bundles.Add(new ScriptBundle("~/bundles/Scripts").Include(
"~/Scripts/scrollTo.js"));
然而,当我运行解决方案时,我得到了
Assembly 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' does not contain a Web resource with name 'scrollTo.js'.
我错过了什么?
答案 0 :(得分:1)
如果你转到你的观点&gt;分享&gt; _Layout.cshtml文件,你添加了“〜@ Script.Render(”〜/ bundles / Scripts“)?