Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nuget spec dependencies, get latest version?

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

like image 926
George Mauer Avatar asked Jul 15 '14 18:07

George Mauer


People also ask

How do I get a new NuGet version?

Visit nuget.org/downloads and select NuGet 3.3 or higher (2.8. 6 is not compatible with Mono). The latest version is always recommended, and 4.1. 0+ is required to publish packages to nuget.org.

How do I update NuGet dependencies?

By Command-line: You can download nuget.exe,and add the path where it exists to Path system environment variables. Then you could simply reference the nuget.exe directly. After that you can use command like nuget update YourSolution. sln in Package Manager Console to update the dependencies for solution.

Do NuGet packages include dependencies?

Any time a package is installed or reinstalled, which includes being installed as part of a restore process, NuGet also installs any additional packages on which that first package depends. Those immediate dependencies might then also have dependencies on their own, which can continue to an arbitrary depth.

Where can I find Nuspec file?

The current nuspec. xsd schema file can be found in the NuGet GitHub repository. All XML element names in the . nuspec file are case-sensitive, as is the case for XML in general.


2 Answers

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

like image 120
Joseph Devlin Avatar answered Sep 18 '22 13:09

Joseph Devlin


I am guessing you are trying to use nuget install or nuget restore to pull down the NuGet package using NuGet.exe.

The version attribute in the packages.config defines the version installed in the project or solution.

To get the latest version of the psake NuGet package you would need to install it using the Package Manager console, or the Manage Packages dialog or by knowing the exact version of the package, adding that into the packages.config file, and using package restore. Since psake is a solution level package it does not update your project the last option is feasible.

The version ranges are used to restrict the package versions that are allowed to be installed in your project.

<packages>     <package id="SomePackage" version="2.1.0" allowedVersions="[2,3)" /> </packages> 
like image 25
Matt Ward Avatar answered Sep 16 '22 13:09

Matt Ward