Conservative install and update.

Topics: General
Feb 4, 2013 at 12:29 PM
Edited Feb 8, 2013 at 10:04 AM
Hello NuGet devs,

Just to point out that I've open an feature request: 3011

I'd be willing to work on a patch, if we can agree on the way to expose this functionality.

Currently my suggestion is just to add an option -PreferInstalledDependencies to the PS commands Install-Package and Update-Package.
Feb 6, 2013 at 6:01 PM
I'm curious. Why do you name the flag "PreferInstalledDependencies"?
Feb 8, 2013 at 10:23 AM
Edited Feb 8, 2013 at 10:24 AM
I would name it -Safe, but -Safe already means something else for Update-Package...

Currently, during installation, Install-Package resolve dependencies by looking:
  • in the repository of installed package
  • in the repository of online package.
[AFAIU the resolution is done using the rule "lowest major.minor version matching the constraint, highest patch version available"]

Nuget then picks the highest version between the two.
Hence the proposed name "-PreferInstalledDependencies", meaning that nuget would prefer the installed version even if a newer patch version is available online.

Other names I could came up with:
[Those two might sound strange in Update-Package]
-Safer / -Safest

Another option would be to consider changing the meaning of -Safe for Update-Package.

At the moment, it means:
  • Update the package to it's latest patch version (within it's current major.minor), and update its dependencies accordingly.
  • if -Version is not specified, keep the same behavior
  • if -Version is specified, update the package the specified version, and updates its dependencies only if strictly necessary.
So many options, who is going to make the call? :)
I think I like "-Safe" the best, but it's a harder decision to make because it changes existing behavior.