简体   繁体   中英

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

I know this has been asked a hundred times before, but alas, no solutions here work for this NuGet bug in VS2012.
All I did was upgrade to the latest Ajax toolkit and my site is broken as a result. I've tried uninstalling the NuGet package and reinstalling everything with no joy. I have jQuery, jQueryUI, and the site builds just fine, however, at runtime, it crashes with this dreaded error. adding .js to the end creates more errors, and so forth.

    <ajaxToolkit:ToolkitScriptManager ID="tksm1" runat="server" EnableViewState="False">
        <Scripts>            
            <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 Path="~/Scripts/search.js" />
        </Scripts>
    </ajaxToolkit:ToolkitScriptManager>

All references are pointing correctly as far as I can tell.

I've "cleaned" the solution, deleted bin folder, etc, etc. no joy there either. I've copied and pasted other solutions (no joy).

Version: Microsoft Visual Studio Professional 2012 Version 11.0.61030.00 Update 4 Microsoft.NET Framework Version 4.5.51641 Windows 8.1 (updated as of today). I'm at wit's end here - should I reinstall VS?

OK - I figured out the most painless way of doing this. I restored a backup (good idea to make backups) of the site in question. Before loading it into VS2012, I deleted the \\packages\\ folder completely. Then, I opened the project and VS restored the \\packages\\ folder and all references (by dumb luck, I discovered that VS will rebuild things for you). I still had the old versions of jQuery, jQUI, ACTK, etc. and tested to make sure everything worked. The solution this time around is to avoid the NuGet GUI altogether (there is some sort of bug whereby it will not uninstall things properly). I went to the command line instead and typed in the appropriate commands to install the latest versions (the old versions were removed properly this time). I cleaned & rebuilt the solution and it works just fine now. (no editing of .config files required).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM