[英]Visual Studio NuGet: Download the official package instead of pre-release
I'm trying to import and install a NuGet package (in this case, protobuf-net) to one of our projects. 我正在尝试将NuGet包(在本例中为protobuf-net)导入并安装到我们的项目之一。 When i search for this package in NuGet package manager, the version that's displayed is (at this moment) 当我在NuGet程序包管理器中搜索此程序包时,显示的版本是(此时)
2.1.0-alpha-1 (Prerelease) 2.1.0-alpha-1(预发行版)
I've also noticed similar things with json.net and other libraries (they point to alpha/beta releases). 我还注意到json.net和其他库(它们指向alpha / beta版本)也有类似的情况。
I do not want to import this version and would rather install the latest stable version instead. 我不想导入此版本,而是要安装最新的稳定版本。 I know that I can do this from the package manager console directly after finding out the version number from their website but I was wondering if there was: 我知道从他们的网站找到版本号后,我可以直接从软件包管理器控制台中执行此操作,但我想知道是否存在:
Many thanks in advance, 提前谢谢了,
This is already the default behavior. 这已经是默认行为。
install-package protobuf-net
will give you the latest stable release. install-package protobuf-net
将为您提供最新的稳定版本。
If you want the prerelease you must explicitly state this in the install command: 如果需要预发行版,则必须在install命令中明确声明:
install-package protobuf-net -pre
For stable versions: 对于稳定版本:
Get-Package -ListAvailable -Filter protobuf-net -Source https://www.nuget.org/api/v2/ -AllVersions -IncludePrerelease | where {$_.Id -eq "protobuf-net"}
For prerelease versions: 对于预发行版本:
Get-Package -ListAvailable -Filter protobuf-net -Source https://www.nuget.org/api/v2/ -AllVersions | where {$_.Id -eq "protobuf-net"}
Unfortunately this does not show all versions (but should). 不幸的是,这并不显示所有版本(但应该显示)。 The best method is to go to official NuGet web site, choose version and install it explicitly: 最好的方法是转到NuGet官方网站,选择版本并进行明确安装:
Install-Package protobuf-net -Version 2.0.0.668
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.