简体   繁体   English

Visual Studio NuGet:下载官方软件包而不是预发行版

[英]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: 我知道从他们的网站找到版本号后,我可以直接从软件包管理器控制台中执行此操作,但我想知道是否存在:

  1. Either a way to force VS to show the stable versions only and ignore showing alpha/beta releases OR 强制VS只显示稳定版本而忽略显示alpha / beta版本的一种方法
  2. Show all the available releases for a certain project so that I could choose which one I want to install. 显示某个项目的所有可用发行版,以便我可以选择要安装的版本。

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

Don't know about vs2013 but vs2015 has a checkbox next to Filter called "Include prerelease". 不知道vs2013,但vs2015在筛选器旁边有一个复选框,称为“包括预发行版本”。 Uncheck this. 取消选中此项。

See Screenshot 见截图 NuGet版本

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM