可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
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.