gpt4 book ai didi

c# - 将js文件添加到bundle会导致错误

转载 作者:行者123 更新时间:2023-12-03 12:28:06 25 4
gpt4 key购买 nike

我正在尝试使用 VS 2013 将 jquery rollTo.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'. 

我错过了什么?

最佳答案

如果您转到“ View ”>“共享”>“_Layout.cshtml”文件,您是否添加了“~@Scripts.Render(“~/bundles/Scripts”)?

关于c# - 将js文件添加到bundle会导致错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24083946/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com