編輯:這不適用於nuspec文件,但您可以按照this answer中所述進行更改以始終獲得最新版本。指定的更改僅適用於您自己的機器。對於任何你自己的代碼,你可以添加你自己的nuget.config文件來實現這個功能。
今天沒有最新版本的關鍵字。然而有一種說法,從這個版本開始使用。你可以找到完整的reference here。請注意,這並不意味着NuGet將始終爲列出的依賴項獲取最新版本。
一個例子(從提供的鏈接):
<!-- Accepts any version above, but not include 4.1.3. This might be
used to guarantee a dependency with a specific bug fix. -->
<dependency id="ExamplePackage" version="(4.1.3,)" />
<!-- Accepts any version up below 5.x, which might be used to prevent
pulling in a later version of a dependency that changed its interface.
However, this form is not recommended because it can be difficult to
determine the lowest version. -->
<dependency id="ExamplePackage" version="(,5.0)" />
<!-- Accepts any 1.x or 2.x version, but no 0.x or 3.x and higher versions -->
<dependency id="ExamplePackage" version="[1,3)" />
<!-- Accepts 1.3.2 up to 1.4.x, but not 1.5 and higher. -->
<dependency id="ExamplePackage" version="[1.3.2,1.5)" />