Ich versuche, meine benutzerdefinierte Javascript-Datei in meine asp.net-Webformulare zu importieren. Visual Studios erzeugt Textimportblock im Inneren des Körpers, der wie folgt aussieht:ASP.NET Importieren von JavaScript-Datei
<asp:ScriptManager runat="server">
<Scripts>
<%--To learn more about bundling scripts in ScriptManager see http://go.microsoft.com/fwlink/?LinkID=301884 --%>
<%--Framework Scripts--%>
<asp:ScriptReference Name="MsAjaxBundle" />
<asp:ScriptReference Name="jquery" />
<asp:ScriptReference Name="bootstrap" />
<asp:ScriptReference Name="respond" />
<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" />
<%--Site Scripts--%>
</Scripts>
</asp:ScriptManager>
Aber wenn ich versuche, hinzuzufügen:
<asp:ScriptReference Name="Site.js" Path="Scripts/Site.js"/>
und führen Sie die Seite, die ich bekomme diese Fehlermeldung:
The assembly 'System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' does not contain a Web resource that has the name 'Site.js'. Make sure that the resource name is spelled correctly.
Ich habe versucht, dies zu meinem BundleConfig.cs
hinzuzufügen:
bundles.Add(new ScriptBundle("~/bundles/Site").Include(
"~/Scripts/Site.js"));
Das änderte nichts. Irgendeine Idee, wie man meine js Akte importiert?