Is it possible to tell NuGet that you want to use the latest version of a package with a specific major version and never higher than this major version?
For example, let's take an example with jQuery: we cannot use version 2.x if we need support for older browsers. We are limited in using the latest version 1.x.
We know that the jQuery version currently available (and offered by default in the Manage Nuget Packages dialog box) is 2.1.1. Instead of using this version, we need to use the latest most recent version of the jQuery 1.x branch, currently 1.11.1.
I know how to install version 1.11.1 initially. One simple solution is to manually edit the packages.config file to replace the value of the version attribute with 1.11.1 :
<packages> <package id="jQuery" version="1.11.1" targetFramework="net451" /> </packages>
and build a project.
I donβt know how to tell NuGet to track the release of new versions of the 1.x branch, in order to offer me an update for them in the same way as it would when creating a new version 2.x

By default, NuGet will always try to upgrade to the latest version 2.x, not the latest version 1.x.
In other words, when using packages with older major versions, you need to manually check for releases and install NuGet every time.
I tried using an asterisk in the version attribute:
<packages> <package id="Package1" version="1.*" targetFramework="net40" /> </packages>
But NuGet throws an exception:
NuGet Package restore failed for project Project1: System.IO.InvalidDataException: Unable to parse version value '1.*' from 'packages.config'. at NuGet.PackageReferenceFile.<GetPackageReferences>d__0.MoveNext() at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) at NuGet.VsEvents.PackageRestorer.RestorePackages(String packageReferenceFileFullPath, IFileSystem fileSystem) at NuGet.VsEvents.PackageRestorer.PackageRestore(ProjectPackageReferenceFile projectPackageReferenceFile).
So how do you achieve the above goal?
Alexander Abakumov
source share