Skip to main content

How to Search for NuGet Packages from the Command Line (dotnet package search)

· 5 min read
Jagdish Kumawat
Founder @ Dewiride

Before adding a package, you usually want two answers: which package, and which version. dotnet package search gets both from nuget.org without leaving the terminal. This guide searches by keyword, lists every version of one package, includes previews, and switches to JSON, using a real question as the example: which EF Core providers for MySQL support EF Core 10?

Prerequisites​

  • The .NET SDK 8.0.2xx or later. The command reference "applies to: ✔️ .NET 8.0.2xx SDK and later versions". This guide uses .NET 10.
  • Internet access to nuget.org.

Step 1: Search by Keyword​

Terminal
dotnet package search EntityFrameworkCore.MySql --take 5
  • EntityFrameworkCore.MySql is the search term. It isn't limited to exact names: Microsoft.EntityFrameworkCore and Z.EntityFramework.Extensions.EFCore matched too.
  • --take 5 limits the results. The reference: "The number of results to return. The default value is 20."
Output
****************************************
Source: nuget.org (https://api.nuget.org/v3/index.json)
| Package ID | Latest Version | Owners | Total Downloads |
| ----------------------- | -------------- | ----------------------- | --------------- |
| Microsoft.EntityFramewo | 10.0.14 | aspnet, dotnetframework | 2,68,53,30,159 |
| rkCore | | , EntityFramework, Micr | |
| | | osoft | |
| ----------------------- | -------------- | ----------------------- | --------------- |
| Pomelo.EntityFrameworkC | 9.0.0 | AmamiyaYuuko, bgrainger | 14,34,30,246 |
| ore.MySql | | , LauXjpn, PomeloFounda | |
| | | tion | |
| ----------------------- | -------------- | ----------------------- | --------------- |
| MySql.EntityFrameworkCo | 10.0.12 | MySQL | 1,62,40,637 |
| re | | | |
| ----------------------- | -------------- | ----------------------- | --------------- |
| Z.EntityFramework.Exten | 10.105.9 | zzzprojects | 7,34,90,968 |
| sions.EFCore | | | |
| ----------------------- | -------------- | ----------------------- | --------------- |
| MySql.Data.EntityFramew | 8.0.22 | MySQL | 81,83,005 |
| orkCore | | | |
| ----------------------- | -------------- | ----------------------- | --------------- |

A terminal where dotnet package search EntityFrameworkCore.MySql --take 5 shows a table with Microsoft.EntityFrameworkCore 10.0.14, Pomelo.EntityFrameworkCore.MySql 9.0.0, MySql.EntityFrameworkCore 10.0.12 and two more packages, with owners and total downloads.

How to read it:

  • Long IDs wrap inside the narrow first column: Pomelo.EntityFrameworkC / ore.MySql is Pomelo.EntityFrameworkCore.MySql.
  • Owners shows who publishes the package: MySQL for Oracle's provider, the Pomelo Foundation's team for Pomelo's.
  • Total Downloads is formatted for the machine's region; this Mac groups digits the Indian way, so 1,62,40,637 is 16,240,637.

Already one answer: Pomelo's newest stable version is 9.0.0, Oracle's is 10.0.12.

Step 2: List Every Version of One Package​

--exact-match "narrows the search to only include packages whose IDs exactly match the specified search term", and "provides a concise list of all available versions for the identified package":

Terminal
dotnet package search MySql.EntityFrameworkCore --exact-match
Output (last rows)
| MySql.EntityFrameworkCo | 10.0.1 | | N/A |
| re | | | |
| ----------------------- | -------- | ------ | --------------- |
| MySql.EntityFrameworkCo | 10.0.7 | | N/A |
| re | | | |
| ----------------------- | -------- | ------ | --------------- |
| MySql.EntityFrameworkCo | 10.0.9 | | N/A |
| re | | | |
| ----------------------- | -------- | ------ | --------------- |
| MySql.EntityFrameworkCo | 10.0.12 | | N/A |
| re | | | |
| ----------------------- | -------- | ------ | --------------- |

The list is oldest first, so the newest stable version is at the bottom. The docs add that it "Causes --take and --skip options to be ignored": you always get every version.

Step 3: Include Previews​

--prerelease lets "prerelease packages to be shown". For Pomelo, to check whether an EF Core 10 version exists even as a preview:

Terminal
dotnet package search Pomelo.EntityFrameworkCore.MySql --exact-match --prerelease
Output (last rows)
| Pomelo.EntityFrameworkC | 9.0.0-preview.1 | | N/A |
| ore.MySql | | | |
| ----------------------- | ----------------------- | ------ | --------------- |
| Pomelo.EntityFrameworkC | 9.0.0-preview.2.efcore. | | N/A |
| ore.MySql | 9.0.0 | | |
| ----------------------- | ----------------------- | ------ | --------------- |
| Pomelo.EntityFrameworkC | 9.0.0-preview.3.efcore. | | N/A |
| ore.MySql | 9.0.0 | | |
| ----------------------- | ----------------------- | ------ | --------------- |
| Pomelo.EntityFrameworkC | 9.0.0-rc.1.efcore.9.0.0 | | N/A |
| ore.MySql | | | |
| ----------------------- | ----------------------- | ------ | --------------- |
| Pomelo.EntityFrameworkC | 9.0.0 | | N/A |
| ore.MySql | | | |
| ----------------------- | ----------------------- | ------ | --------------- |

A terminal where dotnet package search Pomelo.EntityFrameworkCore.MySql --exact-match --prerelease ends with 9.0.0 previews, a release candidate and 9.0.0, and no version 10.

Nothing after 9.0.0, not even a preview: at the time of writing, Pomelo has no version for EF Core 10.

Step 4: Get JSON for Scripts​

--format json (the default is table) is easier to read in a script, and doesn't wrap:

Terminal
dotnet package search MySql.EntityFrameworkCore --exact-match --prerelease --format json
Output (first entries)
{
"version": 2,
"problems": [],
"searchResult": [
{
"sourceName": "nuget.org",
"packages": [
{
"id": "MySql.EntityFrameworkCore",
"version": "3.1.10"
},
{
"id": "MySql.EntityFrameworkCore",
"version": "3.1.12"
},

The last versions in that list were 9.0.20, 10.0.0-preview, 10.0.0-rc, 10.0.1, 10.0.7, 10.0.9, 10.0.12 and 11.0.0-preview: Oracle already publishes a preview for EF Core 11.

Common Mistakes​

MistakeWhat happensDo this instead
Reading the first row as the newest version in --exact-matchVersions are listed oldest firstRead the last row
Searching a partial name with --exact-matchNo resultsSearch the keyword first, then the exact ID
Picking the package with the most downloadsOld packages have big totals, such as MySql.Data.EntityFrameworkCore 8.0.22 hereCheck the latest version and the owner
Parsing the table in scriptsWrapped IDs break the parsingUse --format json

FAQ​

Does it search private feeds too?​

It searches the package sources NuGet is configured with; here only nuget.org, shown in the Source: line. The command's help lists --source, "The package source to search", which can be repeated to search several feeds.

Is this the same as dotnet package add with no version?​

No: search only reads. dotnet package add installs the newest stable version, which is the last non-preview row of --exact-match.

Conclusion​

dotnet package search <term> searches nuget.org from the terminal; --exact-match lists every version of one package, oldest first; --prerelease adds previews; --format json makes the results easy to script. Here it showed in a minute that Oracle's MySQL provider supports EF Core 10 and Pomelo's doesn't yet.

Additional Resources​

Stay Updated

Subscribe to our newsletter for the latest tutorials, tech insights, and developer news.

By subscribing, you agree to our privacy policy. Unsubscribe at any time.