nuget spec dependencies, get latest version?

匿名 (未验证) 提交于 2019-12-03 01:17:01

问题:

In the nuspec versioning docs I see

1.0  = 1.0 ≤ x (,1.0]  = x ≤ 1.0 (,1.0)  = x 

I have a packages.config that looks like this

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

I've tried both

and

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

I am using Nuget.exe 2.8.2

回答1:

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

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



回答2:

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.



回答3:

Alternatively, you could run restore on an arbitrary version followed by update as per https://docs.nuget.org/consume/command-line-reference. To ensure the latest you would need to re-run update.

Update packages to latest available versions. This command also updates NuGet.exe itself. Please note that the presence of Packages folder is required to run the Update command. A recommended way is to run NuGet.exe Restore command first before running the Update command.



回答4:

You can modify your .cspoj file to execute a "BeforeBuild" target like this :

Note that : u'll need to have the "Nuget.exe" in ur solution directory.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!