Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I update MVC 3 Project to jQuery 1.6?

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

Created a brand new ASP.MVC 3 application. Wanted to upgrade jQuery to version 1.6 from the default jQuery 1.5.1.

In the 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 a different syntax to update a package? Do I need to remove all those dependent packages and re-add them?

like image 903
Dan Sorensen Avatar asked May 06 '11 19:05

Dan Sorensen


Video Answer


2 Answers

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

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

with:

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

after downloading jquery 1.6 and including it in your Scripts folder obviously.

Of course if you are using a CDN (which is what you should by the way if your site is publicly facing) then simply open ~/Views/Shared/_Layout.cshtml and replace:

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

with:

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

and that's pretty much all you're gonna need.

like image 26
Darin Dimitrov Avatar answered Oct 11 '22 12:10

Darin Dimitrov


Before updating jQuery to version 1.6, you'll need to upgrade those packages to a version that supports jQuery 1.6.

like image 122
Kevin LaBranche Avatar answered Oct 11 '22 12:10

Kevin LaBranche