Old jQuery installed as dependency

Mar 16, 2012 at 6:21 PM

Is there a reason why a package that has a dependency on jQuery >= 1.0 would load 1.4.4 instead of the latest version?  Luckily, my jQuery plugin doesn't depend on any features that didn't exist in 1.4.4, however, it would be nice if it would install the latest version.

Mar 16, 2012 at 6:27 PM

Can you provide steps for us to reproduce this? Ideally, starting from a new app, what packages did you install and in what order?

Mar 16, 2012 at 6:37 PM
I created a new asp.net web forms application that I called NuGetWebTests.

From package manager console:

PM> install-package jquery.remainingCharacters
Attempting to resolve dependency 'jquery (≥ 1.0)'.
Successfully installed 'jQuery 1.4.4'.
Successfully installed 'jQuery.remainingCharacters 1.0.1'.
Successfully added 'jQuery 1.4.4' to NuGetWebTests.
Successfully added 'jQuery.remainingCharacters 1.0.1' to NuGetWebTests.


--
Bryan Johns
K4GDW
http://www.greendragonweb.com

Do not meddle in the affairs of dragons, for you are crunchy and taste
good with ketchup.



On Fri, Mar 16, 2012 at 1:27 PM, [email removed] wrote:
> From: drewmiller
>
> Can you provide steps for us to reproduce this? Ideally, starting from a new
> app, what packages did you install and in what order?
>
> Read the full discussion online.
>
> To add a post to this discussion, reply to this email
> ([email removed])
>
> To start a new discussion for this project, email
> [email removed]
>
> You are receiving this email because you subscribed to this discussion on
> CodePlex. You can unsubscribe on CodePlex.com.
>
> Please note: Images and attachments will be removed from emails. Any posts
> to this discussion will also be available online at CodePlex.com
Mar 16, 2012 at 8:06 PM

This is by design. NuGet always installs the lowest version that matches all requirements, which generally helps prevent breaks when new versions come out.

See my earlier post series for a full description of the algorithm.

If you need a newer jQuery, why not just depend on what you need?

Mar 16, 2012 at 8:48 PM
If you read my original post, you'll see where I said that luckily, my
plugin didn't need a higher version.

It just caught me by surprise when, on a clean project that had no
existing jQuery code, it defaulted to an old version.

--
Bryan Johns
K4GDW
http://www.greendragonweb.com

Do not meddle in the affairs of dragons, for you are crunchy and taste
good with ketchup.



On Fri, Mar 16, 2012 at 3:06 PM, [email removed] wrote:
> From: davidebbo
>
> This is by design. NuGet always installs the lowest version that matches all
> requirements, which generally helps prevent breaks when new versions come
> out.
>
> See my earlier post series for a full description of the algorithm.
>
> If you need a newer jQuery, why not just depend on what you need?
Developer
Mar 17, 2012 at 2:06 AM
If you want the latest, remove the version attribute.

Sent from my Windows Phone

From: k4gdw
Sent: 3/16/2012 1:48 PM
To: David Fowler
Subject: Re: Old jQuery installed as dependency [nuget:348936]

From: k4gdw

If you read my original post, you'll see where I said that luckily, my
plugin didn't need a higher version.

It just caught me by surprise when, on a clean project that had no
existing jQuery code, it defaulted to an old version.

--
Bryan Johns
K4GDW
http://www.greendragonweb.com

Do not meddle in the affairs of dragons, for you are crunchy and taste
good with ketchup.



On Fri, Mar 16, 2012 at 3:06 PM, [email removed] wrote:
> From: davidebbo
>
> This is by design. NuGet always installs the lowest version that matches all
> requirements, which generally helps prevent breaks when new versions come
> out.
>
> See my earlier post series for a full description of the algorithm.
>
> If you need a newer jQuery, why not just depend on what you need?
Mar 17, 2012 at 2:12 AM
I'll give that a try before I push the next version. It's not so much that
I want the latest version as it is that, at least to me, it makes more sense
for it to install the latest if there's not already a compatible version
installed. I'm not wanting to force people to upgrade to the latest if they
want to use my plugin, but if they're not already using jQuery for some
other purpose, why not use the latest?

--
Bryan Johns
K4GDW

Do not argue with an idiot. He will drag you down to his level and beat you
with experience.

> -----Original Message-----
> From: dfowler [mailto:[email removed]
> Sent: Friday, March 16, 2012 9:07 PM
> To: [email removed]
> Subject: Re: Old jQuery installed as dependency [nuget:348936]
>
> From: dfowler
>
> If you want the latest, remove the version attribute.
>
> Sent from my Windows Phone
>
> ________________________________
>
> From: k4gdw
> Sent: 3/16/2012 1:48 PM
> To: David Fowler
> Subject: Re: Old jQuery installed as dependency [nuget:348936]
>
>
>
> From: k4gdw
>
> If you read my original post, you'll see where I said that luckily, my
> plugin didn't need a higher version.
>
> It just caught me by surprise when, on a clean project that had no
> existing jQuery code, it defaulted to an old version.
>
> --
> Bryan Johns
> K4GDW
> http://www.greendragonweb.com
>
> Do not meddle in the affairs of dragons, for you are crunchy and taste
> good with ketchup.
>
>
>
> On Fri, Mar 16, 2012 at 3:06 PM, [email removed] wrote:
> > From: davidebbo
> >
> > This is by design. NuGet always installs the lowest version that
> > matches all requirements, which generally helps prevent breaks when
> > new versions come out.
> >
> > See my earlier post series for a full description of the algorithm.
> >
> > If you need a newer jQuery, why not just depend on what you need?
>
> Read the full discussion online
> <http://nuget.codeplex.com/discussions/348936#post811719> .
>
> To add a post to this discussion, reply to this email
> ([email removed]
> <mailto:[email removed]?subject=[nuget:348936]> )
>
> To start a new discussion for this project, email
> [email removed]
>
> You are receiving this email because you subscribed to this discussion
> on CodePlex. You can unsubscribe
> <https://nuget.codeplex.com/discussions/348936/unsubscribe/> on
> CodePlex.com.
>
> Please note: Images and attachments will be removed from emails. Any
> posts to this discussion will also be available online at CodePlex.com
Mar 17, 2012 at 4:47 AM

Always installing the latest may seem like a good idea, but in practice would cause many working scenario to suddenly start break as new dependency versions become available. See my post mentioned earlier for details.

Mar 17, 2012 at 10:57 AM
Edited Apr 13, 2012 at 2:09 AM

Bingo!

 I will share your codes:) Moreover, will it be working on some other older editions?

Mar 28, 2012 at 8:48 AM

I think you are using a separate file for jquery. Try with live jquery such like http://....

_____________________________

Overtime

Mar 28, 2012 at 11:26 AM
When you create a NuGet package, you specify what other NuGet packages it
depends on. Then when you, or another user, installs that package, NuGet
resolves all the dependencies for you. In the case of jQuery, NuGet
installs a local copy of jQuery into your web project. It doesn't insert
the <script> tag into your html (aspx or vb/cshtml). That's up to you.
During development, it's generally a good idea to work against the local
copy, then when you go to production, link against a "live" jQuery from a
CDN such as Google or Microsoft.

Most of the time, when you create a NuGet package that depends on another
package, you specify a minimum version. NuGet's dependency resolver gets
the LOWEST minor version at the highest revision it knows about that meets
your minimum version. For example, if you create a package that depends on
jQuery >= 1.0, NuGet will install jQuery 1.4.4, even though it has jQuery
1.7.1 available. An earlier post on this thread give links to explanations
of why it works that way.

It would make more sense to me, if NuGet would first look at the packages
the user already has installed, and then install the highest version that
doesn't violate a pre-existing package dependency. However, that's not how
it works. Now that I know that, there are steps I, as a package creator and
a package user, can take to work around it.

As a package user, if I install a package that installs other packages and I
want to make sure I get the latest versions, I can manually issue
upgrade-package commands for each package I want to upgrade.

As a package creator, I can not specify a version requirement (unless I know
that my package only works with specific versions). That will trigger NuGet
to install, or upgrade, any dependencies to the latest version and trust
NuGet to look at existing packages to make sure it doesn't break them by
doing so. However, if I do this, I have to stay on top of dependency
updates and make sure I test my package against the new versions and release
an update of my package if the latest version of a dependency has a breaking
change. This can be a maintenance nightmare for folks with lots of
packages.

--
Bryan Johns
K4GDW

The early bird might get the worm, but the second mouse gets the cheese.

> -----Original Message-----
> From: overtime28 [mailto:[email removed]
> Sent: Wednesday, March 28, 2012 3:48 AM
> To: [email removed]
> Subject: Re: Old jQuery installed as dependency [nuget:348936]
>
> From: overtime28
>
> I think you are using a separate file for jquery. Try with live jquery
> such like http://....
>
> _____________________________
>
> Overtime <http://overtime.com>
>
> Read the full discussion online
> <http://nuget.codeplex.com/discussions/348936#post816432> .
>
> To add a post to this discussion, reply to this email
> ([email removed]
> <mailto:[email removed]?subject=[nuget:348936]> )
>
> To start a new discussion for this project, email
> [email removed]
>
> You are receiving this email because you subscribed to this discussion
> on CodePlex. You can unsubscribe
> <https://nuget.codeplex.com/discussions/348936/unsubscribe/> on
> CodePlex.com.
>
> Please note: Images and attachments will be removed from emails. Any
> posts to this discussion will also be available online at CodePlex.com