How to upgrade MVC 3 Project to jQuery 1.6?

Using ASP.MVC 3 + Nuget, I added packages, but this is the first time I tried to update a package with dependencies. So far I'm stuck ...

A completely new ASP.MVC 3 application has been created. It is required to upgrade jQuery to version 1.6 from standard jQuery 1.5.1.

In the package manager console:

PM> install-package jquery Successfully installed 'jQuery 1.6'. Install failed. Rolling back... Install-Package : Conflict occurred. 'jQuery 1.5.1' referenced but requested 'jQuery 1.6'. 'jQuery.vsdoc 1.5.1, jQuery.Validation 1.8.0, jQuery.UI.Combined 1.8.11' depend on 'jQuery 1.5.1'. 

Is there any other syntax for updating the package? Do I need to remove all these dependent packages and re-add them?

+8
asp.net-mvc visual-studio-2010 nuget
source share
5 answers

Before upgrading jQuery to version 1.6, you need to upgrade these packages to a version that supports jQuery 1.6.

+10
source share

Oh why so hard? Just open the file ~/Views/Shared/_Layout.cshtml and replace:

 <script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script> 

from:

 <script src="@Url.Content("~/Scripts/jquery-1.6.min.js")" type="text/javascript"></script> 

after loading jquery 1.6 and, in particular, in the Scripts folder.

Of course, if you use CDN (this is what you need, by the way, if your site is open to the public), just open ~/Views/Shared/_Layout.cshtml and replace:

 <script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script> 

from:

 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js" type="text/javascript"></script> 

and that’s almost all you need.

+6
source share

NuGet's package manager is the right way to upgrade jQuery, but so far I have not seen this happen to us. I use a simple way to copy and paste, and then fix the problem when it pops up.

+2
source share
  • in [Add link to library package] and [Installed packages] to remove dependent packages.
  • you can install jQuery.
+1
source share

I had the same problem when trying to install a package that required a newer version of jQuery. I simply uninstalled all jQuery dependent packages and then installed them again one by one. He then allowed me to install my package.

0
source share

All Articles