Can I keep Nuget on the jQuery 1.9.x/1.x path (instead of upgrading to 2.x)?

In my opinion, this is a mistake on the package author's part. An update which removes support for several browsers should have been made into a separate version 2 nuget package and advertised accordingly, i.e. with significant disclaimers. The 1.9 library is not legacy and will receive further updates in the future. I've been in touch with the package author and will write more if I receive a reply.

In the interim, you can constrain the version of your package by using the following syntax in your packages.config:

<package id="jQuery" version="1.9.1" allowedVersions="[1.9.1]" />

There's more information on version constraints here:

http://docs.nuget.org/docs/reference/Versioning

After making the config change, an update should not upgrade your jQuery package to the 2.0 release. There have been issues in the past with the UI package manager not respecting the allowedVersions attribute (https://nuget.codeplex.com/workitem/1891), so you may have to use the command line if you encounter this problem.

However, none of this solves the problem of what happens when the 1.9 branch gets updated because the package feed will now be on the 2.0+ track. I assume you'll have to switch to a new nuget package specifically written to support the 'legacy' 1.x version, or copy the script in manually each time.

In any case, I'll update this when I learn more.

Edit:

The package author has stated that both the 1.x and 2.x paths will be supported in the future, i.e. the package feed will contain parallel versions instead of them being split. As far as I can see, the solution is to use a version constraint at the package config level to prevent an update to the 2.x version, e.g.:

<package id="jQuery" version="1.9.1" allowedVersions="[1.9.1,2)" />

(Specifying both min and max versions in allowedVersions should allow updating without risking a switch to the 2.x version. By the way, the right parenthesis looks strange, but is correct - it means 'less than version 2'.)


how about to specify the version?

PM> Install-Package jQuery -Version 1.9.1

References: http://nuget.org/packages/jQuery/1.9.1


Nuget now has a jquery1 package that only tracks the 1.x branch, so you should be able to swap out the core jQuery package for this one.


I combined the two solutions from the top for @TeYoU

First I Installed the package from the package manager console:

Tools Menu -> Library Package Manager -> Package Manager Console

PM> Install-Package jQuery -Version 1.9.1

Then I edited the packages.config as @Dave R. says:

<package id="jQuery" version="1.9.1" allowedVersions="[1.9.1,2)" />

Then I updated to the current version, currently 1.10.2 using Nuget Manager and it worked like a charm.