在 NuGet 包管理器控制台中列出特定包的所有可用版本 [英] List all available versions of a specific package in NuGet Package Manager Console

查看:73
本文介绍了在 NuGet 包管理器控制台中列出特定包的所有可用版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

哪个 NuGet PowerShell 命令将返回特定包的所有版本的列表?

我尝试了以下方法,但它只返回一个版本的 NUnit 以及许多其他(非)相关的包,每个包只有一个版本.

Get-Package -Source https://go.microsoft.com/fwlink/?LinkID=206669 -ListAvailable -Filter NUnit -AllVersions

注意:我指定了源 URI,因为我们有自己的内部包源作为默认远程.

我的理解是 -AllVersions 开关应该拉回每个匹配包的每个版本.

我似乎无法弄清楚:

  1. 我做错了吗?
  2. 如果没有,项目维护者(或其他人)是否从包源中删除旧版本?
  3. 如果是,为什么?

解决方案

您的源代码解析为似乎不适用于 -AllVersions 的提要版本 1(我提交了一个问题:https://github.com/NuGet/NuGetGallery/issues/563)

使用 V2 提要对我有用:

get-package -ListAvailable -AllVersions -filter nunit -source https://nuget.org/api/v2/

但请注意,-filter 不是针对特定的包,而更像是搜索词.

作为一种解决方法,我会使用选项卡自动完成来获取特定包的版本列表:

install-package -source https://nuget.org/api/v2/-id nunit -version ;

What NuGet PowerShell command will return a list of all versions of a specific package?

I have tried the following, but it only returns one version of NUnit along with a number of other (un)related packages, each having only one version.

Get-Package -Source https://go.microsoft.com/fwlink/?LinkID=206669 -ListAvailable -Filter NUnit -AllVersions

Note: I specify the source URI because we have our own internal package source as our default remote.

My understanding is that the -AllVersions switch should pull back every version of each matching package.

I can't seem to figure out:

  1. Am I doing it wrong?
  2. If not, are project maintainers (or someone else) removing older versions from the package source?
  3. If they are, why?

解决方案

Your source resolves to the version 1 of the feed which doesn't seem to work with -AllVersions (I filed an issue: https://github.com/NuGet/NuGetGallery/issues/563)

Using the V2 feed works for me:

get-package -ListAvailable -AllVersions -filter nunit -source https://nuget.org/api/v2/

But note that -filter is not for a specific package, but more like a search term.

As a workaround, I'd use tab autocomplete to get the versions list of a specific package:

install-package -source https://nuget.org/api/v2/ -id nunit -version <tab>

这篇关于在 NuGet 包管理器控制台中列出特定包的所有可用版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆