NuGet Command Line will not update packages if you use ExcludeVersion switch

May 13, 2011 at 9:04 PM
Just a note, not sure if this has been reported or not. It appears when you use the ExcludeVersion switch, which you would do to get more of the old Nu like functionality, it will not update packages to the latest version.

Make sure we have the latest version.

C:\Temp>nuget update
Currently running NuGet.exe 1.3.20425.372.
NuGet.exe is up to date.

Normal Experience
What's the normal behavior without the switch? Now, let's run the following commands

C:\Temp>nuget install nhibernate /version 2.1.2.4000 /outputdirectory lib
'log4net (≥ 1.2.10)' not installed. Attempting to retrieve dependency from source...Done.
'Iesi.Collections (≥ 1.0.1)' not installed. Attempting to retrieve dependency from source...Done.
'Antlr (≥ 3.1.1)' not installed. Attempting to retrieve dependency from source...Done.
'Castle.DynamicProxy (≥ 2.1.0)' not installed. Attempting to retrieve dependency from source...Done.
'Castle.Core (= 1.1.0)' not installed. Attempting to retrieve dependency from source...Done.
Successfully installed 'log4net 1.2.10'.
Successfully installed 'Iesi.Collections 1.0.1'.
Successfully installed 'Antlr 3.1.3.42154'.
Successfully installed 'Castle.Core 1.1.0'.
Successfully installed 'Castle.DynamicProxy 2.1.0'.
Successfully installed 'NHibernate 2.1.2.4000'.

C:\Temp>nuget install nhibernate /outputdirectory lib
'Iesi.Collections (≥ 3.2.0.1003)' not installed. Attempting to retrieve dependency from source...Done.
Successfully installed 'Iesi.Collections 3.2.0.1003'.
Successfully installed 'NHibernate 3.2.0.1003'.

It works without ExcludeVersion.

ExcludeVersion Experience
Now let's delete the files in the lib directory.

First we install an older version of nhibernate.

C:\Temp>nuget install nhibernate /version 2.1.2.4000 /outputdirectory lib /x
'log4net (≥ 1.2.10)' not installed. Attempting to retrieve dependency from source... Done.
'Iesi.Collections (≥ 1.0.1)' not installed. Attempting to retrieve dependency from source...Done.
'Antlr (≥ 3.1.1)' not installed. Attempting to retrieve dependency from source...Done.
'Castle.DynamicProxy (≥ 2.1.0)' not installed. Attempting to retrieve dependency from source...Done.
'Castle.Core (= 1.1.0)' not installed. Attempting to retrieve dependency from source...Done.
Successfully installed 'log4net 1.2.10'.
Successfully installed 'Iesi.Collections 1.0.1'.
Successfully installed 'Antlr 3.1.3.42154'.
Successfully installed 'Castle.Core 1.1.0'.
Successfully installed 'Castle.DynamicProxy 2.1.0'.
Successfully installed 'NHibernate 2.1.2.4000'.

Now let's call install for an update.

C:\Temp>nuget install nhibernate /outputdirectory lib /x
Dependency 'log4net (≥ 1.2.10)' already installed.
Dependency 'Iesi.Collections (≥ 1.0.1)' already installed.
Dependency 'Antlr (≥ 3.1.1)' already installed.
Dependency 'Castle.DynamicProxy (≥ 2.1.0)' already installed.
Dependency 'Castle.Core (= 1.1.0)' already installed.
'NHibernate 2.1.2.4000' already installed.


Weird, that didn't work. Let's get explicit about the version I want here now.

C:\Temp>nuget install nhibernate /version 3.2.0.1003 /outputdirectory lib /x
Dependency 'log4net (≥ 1.2.10)' already installed.
Dependency 'Iesi.Collections (≥ 1.0.1)' already installed.
Dependency 'Antlr (≥ 3.1.1)' already installed.
Dependency 'Castle.DynamicProxy (≥ 2.1.0)' already installed.
Dependency 'Castle.Core (= 1.1.0)' already installed.
'NHibernate 2.1.2.4000' already installed.

Interesting. That didn't work either.


BUG? Maybe. Unexpected behavior? Yep.
____
Rob
"Be passionate in all you do"

http://devlicio.us/blogs/rob_reynolds
http://ferventcoder.com
http://twitter.com/ferventcoder
Developer
May 13, 2011 at 10:07 PM

I'm fixing this as part of http://nuget.codeplex.com/workitem/910. Its definitely a bug because we ignore the version entirely when looking up the package.

May 16, 2011 at 5:31 PM
Awesome. Should we submit this as a bug though since the other doesn't even mention this issue (mostly for tracking and future posterity)?
Coordinator
May 16, 2011 at 5:33 PM

Yeah, ideally it should be its own bug.

May 16, 2011 at 5:36 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
May 16, 2011 at 5:37 PM
Ready for triage! :D