nuget spec dependencies, get latest version?

George Mauer picture George Mauer · Jul 15, 2014 · Viewed 23.2k times · Source

In the nuspec versioning docs I see

1.0  = 1.0 ≤ x
(,1.0]  = x ≤ 1.0
(,1.0)  = x < 1.0
[1.0] = x == 1.0
(1.0) = invalid
(1.0,) = 1.0 < x
(1.0,2.0) = 1.0 < x < 2.0
[1.0,2.0] = 1.0 ≤ x ≤ 2.0
empty = latest version.

I have a packages.config that looks like this

<packages>
  <package id="psake" version="4.2.0.1" />
</packages>

and I would like to change the version to "latest".

I've tried both

<packages>
  <package id="psake" version="" />
</packages>

and

<packages>
  <package id="psake" />
</packages>

but both result in Unable to parse version value '' from 'packages.config'.

I am using Nuget.exe 2.8.2

Answer

Joseph Devlin picture Joseph Devlin · Oct 13, 2014

As of Nuget 2.8 you can add the following attribute to your nuget.config

<configuration>
    <config> 
        <add key="dependencyversion" value="Highest" /> 
    </config>
</configuration>

When resolving your packages, the latest version of that package will be resolved. Other attributes include HighestMinor, HighestPatch and lowest (based on semantic versioning)

Source: http://docs.nuget.org/docs/release-notes/nuget-2.8