3

Closed

How can I prevent nuget from reinstalling packages if no newer version was found?

description

Hi,

I'm using the nuget cmd tool in order to install the build tool "FAKE - F# Make" (https://github.com/fsharp/fake) via the following script:

"tools\nuget\nuget.exe" "install" "FAKE" "-OutputDirectory" "tools" "-ExcludeVersion"

Unfortunately nuget deinstalls and reinstalls FAKE every time I run the script even if no newer FAKE version was detected. How can I tell nuget to keep the current installation if no newer version was found?

Cheers,
Steffen
Closed Dec 18, 2013 at 9:15 PM by danliu
verified using latest 2.8 nuget.exe

comments

forki wrote Jan 25, 2013 at 6:47 PM

BTW: I don't want to use the -Version flag since my build should always use the latest FAKE version.

dotnetjunky wrote Jan 31, 2013 at 11:17 PM

This is by design because you include the -ExcludeVersion parameter. When it is present, NuGet cannot determine what the current version you already have, so it just blindly uninstall and reinstall the package.

dotnetjunky wrote Jan 31, 2013 at 11:18 PM

by design

** Closed by dotnetjunky 01/31/2013 3:18PM

forki wrote Feb 1, 2013 at 8:13 AM

Actually nuget knows exactly which version it has installed:

From the output:

Successfully uninstalled 'FAKE 1.74.105.0'.
Successfully installed 'FAKE 1.74.105.0'.

dotnetjunky wrote Feb 5, 2013 at 6:10 PM

Will pull into 2.4 branch.

feiling wrote Oct 23, 2013 at 3:42 AM

The original pull request was rejected because of no reply to code review comments. Implemented our own fix: https://nuget.codeplex.com/SourceControl/changeset/d8712b1cf06c2f05c59b9c4de0b19cceeaeef1b9

danliu wrote Dec 18, 2013 at 9:15 PM

repro steps:
  1. create a new F# project
  2. install nuget.commandline and FAKE package to the project
  3. at the root of the project, make tools\nuget folder and copy nuget.exe to it
  4. start command prompt, type "tools\nuget\nuget.exe install fake -outputdirectory tools -excludeversion" and make sure tools\fake folder is generated with fake.nupkg
  5. type "tools\nuget\nuget.exe install fake -outputdirectory tools -excludeversion" again
  6. verify the output on the command prompt
expected to see that "Package 'fake' is already installed"