'jquery' is not a valid script name. The name must end in '.js'

前端 未结 10 1635
长发绾君心
长发绾君心 2020-12-10 11:56

My ASP.Net project is working well, when suddenly we had a power failure. When I ran my web app, it is now showing a lot of

Could not load assembly S

相关标签:
10条回答
  • 2020-12-10 12:31

    I had a similar situation, but mine happened after I tried to update DotNetOpenAuth.Core. First it said I needed to update NuGet, which I did, then I updated OpenAuth. After that I started getting the "'jquery' is not a valid script name. The name must end in '.js'.".

    If I removed the line adding the jquery bundle, it would happen on jquery-ui etc.

    I uninstalled and reinstalled both the AspNet.ScriptManager.jQuery and AspNet.ScriptManager.Bootstrap packages (as it would eventually complain about that), and still no luck.

    Final step I did was to uninstall and reinstall AjaxControlToolkit from the package manager console and that fixed it for me.

    0 讨论(0)
  • 2020-12-10 12:34

    I had a similar situation and already had the script reference (above) but I also needed to make sure that the dll was copied to the local folder.

    F4 on AspNet.ScriptManager.jQuery and AspNet.ScriptManager.jQuery.UI.Combined and set Copy Local to True.

    0 讨论(0)
  • 2020-12-10 12:38

    may be a little late to the party but I had the same problem and tried numerous solutions as per above and on other pages. I would get the error on the last script reference, no matter what that reference was. I finally decided to remove all the script references and use bundles instead. For example, default application has the following in bundles.config:

    bundles.Add(new ScriptBundle("~/bundles/MsAjaxJs").Include(
        "~/Scripts/WebForms/MsAjax/MicrosoftAjax.js",
    
    ScriptManager.ScriptResourceMapping.AddDefinition(
        "respond",
        new ScriptResourceDefinition
        {
            Path = "~/Scripts/respond.min.js",
            DebugPath = "~/Scripts/respond.js",
        }
    );
    

    So I changed 'respond' to a bundle instead of a script reference:

    bundles.Add(new ScriptBundle("~/bundles/respond").Include(
        "~/Scripts/respond-1.4.2.js"));
    

    along with all other script references, and added them to the master page header:

    <asp:PlaceHolder runat="server">
        <%: Scripts.Render("~/bundles/WebFormsJs") %>
        <%: Scripts.Render("~/bundles/MsAjaxJs") %>
        <%: Scripts.Render("~/bundles/jquery") %>
        <%: Scripts.Render("~/bundles/jqueryui") %>
        <%: Scripts.Render("~/bundles/modernizr") %>
        <%: Scripts.Render("~/bundles/respond") %>
    </asp:PlaceHolder>
    

    This removed the error - finally after 2 days - and allowed me to run some basic pages, including the default Register.aspx page. Not sure what I'll run into next but figured I would pass this along.

    0 讨论(0)
  • 2020-12-10 12:41

    This fixed my issue. Add this BundleConfig.cs Check your paths.

     ScriptManager.ScriptResourceMapping.AddDefinition("bootstrap", new ScriptResourceDefinition {
                    Path = "~/scripts/bootstrap.min.js",
                    DebugPath = "~/scripts/bootstrap.js",
                    LoadSuccessExpression = "bootstrap"});
    

    And kept this in the ScriptManager on the site.master

      <asp:ScriptReference Name="bootstrap" />
    

    Follow this article for more clarity if needed

    0 讨论(0)
提交回复
热议问题