How to list available package versions using the dotnet cli?
Asked Answered
C

4

25

Using the dotnet cli how can you list the available package versions for a specific package?

Candlestand answered 1/9, 2019 at 1:34 Comment(0)
A
15

Short answer: It's not possible (as far as I know, as of Nov 25, 2019).

There are some other options, depending on what you're trying to accomplish.

Ansilme answered 26/11, 2019 at 0:2 Comment(2)
thanks. i came to the same conclusion. will mark this as correct until/if the status changesCandlestand
Not ideal but workaround would be to call i.e. dotnet add package Newtonsoft.Json --version 100.1.1 with any version that we are sure does not exists and it will fail, but also in the output there will be latest version available. Not ideal but something I guess :)Fredrick
D
5

It's possible with "dotnet-search" a dotnet tool.

https://github.com/billpratt/dotnet-search

  • You only need dotnet-core runtime 2.1
  • Install via dotnet tool install --global dotnet-search
  • Search via dotnet search <package-name>
Distress answered 1/7, 2020 at 20:27 Comment(2)
That is very old runtime. Seems like this package is quite outdated.Fredrick
Using this command throws an errorL Unhandled Exception: Newtonsoft.Json.JsonReaderException: JSON integer 4645432572 is too large or small for an Int32. Path 'data[0].totalDownloads', line 1, position 1075.Goingover
H
3

A partial implementation of this feature now ships with .NET 8.0.2. While I don't see a way to list all available versions for a package, it can search for and show the most recent version, optionally including pre-release.

If you're looking to just check if a package exists, or check its latest version, you can use it like so:

dotnet package search <packageID>

The feature to list all versions may come at a later date, but this seems to be a good start.

Related github links:

Hegira answered 7/3 at 23:3 Comment(1)
I'm having trouble getting this CLI tool to work with a github enterprise package store... always throws warn : Failed to retrieve metadata from source ... error. Other mechanisms are working correctly.Selfrespect
B
0

You can do this with the nuget CLI tool, like so: nuget list <package> -AllVersions

Bendicty answered 23/7 at 18:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.