Update jQuery 1.8.3 to jQuery 1.9.0 in ASP.NET MVC 4

13,112

Solution 1

Run your application and from your browser view the application's source - is the version of jQuery 1.9.0 or 1.8.3?

In Visual Studio, if you go to Tools -> Library Package Manager -> Manage Nuget Packages for Solution... then on the left click updates and you should see jQuery listed - click update.

As far as I know, this will look after everything. Check the source again.

One other thing you can do: go to Solution Explorer -> App_Start -> BundleConfig.cs - make sure the first bundles.Add call is like this:

bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                    "~/Scripts/jquery-{version}.js", 
                    "~/Scripts/jquery-migrate-1.0.0.js"));

EDIT:

Read this.

Look at new bundle code - obviously be sure you have downloaded the migrate file.

Solution 2

Just open the package manager console in the nuget package manager and run the command:

Install-package jQuery

Solution 3

You should using Nuget to update. Tools -> Library Package Manager -> Manage Nuget Packages Solution (stop debug mode if you in there)

- when update jquery, you need update other js lib also like 
 + Jquery Validate
 + Microsoft Jquery Unobtrusive Validate
 + Other lib if you think it relate.. 

and in _layout.cshtml Make sure you have something like

@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/jqueryval")
@Scripts.Render("~/bundles/jqueryui")

if you use ajax validate and jqueryui...

Share:
13,112
user197508
Author by

user197508

Musings on Programming, Technology, and Life. We should always build project with the expectation that our project will grow.

Updated on June 17, 2022

Comments

  • user197508
    user197508 almost 2 years

    we use ASP.NET MVC 4 and i update our project to use jQuery 1.9.0 from jQuery 1.8.3, BUT now Not work client scripts,like jQuery validation,jquery unobtrusive ajax and 3rd party jQuery library and etc!

    According to http://blog.jquery.com/2013/01/15/jquery-1-9-final-jquery-2-0-beta-migrate-final-released we must use jQuery Migrate Plugin.we use Bundling in our MVC project,but when i use this plugin, jQuery.migrateWarnings not available in console!

    My Question:

    how we must update jQuery 1.8.3 to jQuery 1.9.0 without any problem in ASP.NET MVC 4 with Bundling enabled?