(NuGet CLI) 列表命令list command (NuGet CLI)

适用于: 包消耗,发布 • 支持的版本: 全部Applies to: package consumption, publishing • Supported versions: all

显示来自给定源的包的列表。Displays a list of packages from a given source. 如果未指定任何源,将使用全局配置文件中定义的所有源 %AppData%\NuGet\NuGet.Config (Windows) 或 ~/.nuget/NuGet/NuGet.ConfigIf no sources are specified, all sources defined in the global configuration file, %AppData%\NuGet\NuGet.Config (Windows) or ~/.nuget/NuGet/NuGet.Config, are used. 如果 NuGet.Config 未指定源,则 list 使用默认源 (nuget.org) 。If NuGet.Config specifies no sources, then list uses the default feed (nuget.org).


nuget list [search terms] [options]

其中,可选搜索词将筛选显示的列表。where the optional search terms will filter the displayed list. 搜索词 应用于包、标记和包说明的名称,就像在 nuget.org 上使用时一样。Search terms are applied to the names of packages, tags, and package descriptions just as they are when using them on nuget.org.


  • -AllVersions

    列出包的所有版本。List all versions of a package. 默认情况下,仅显示最新的包版本。By default, only the latest package version is displayed.

  • -ConfigFile

    要应用的 NuGet 配置文件。The NuGet configuration file to apply. 如果未指定,则 %AppData%\NuGet\NuGet.Config 使用 (Windows) ~/.nuget/NuGet/NuGet.Config~/.config/NuGet/NuGet.Config (Mac/Linux) 。If not specified, %AppData%\NuGet\NuGet.Config (Windows), or ~/.nuget/NuGet/NuGet.Config or ~/.config/NuGet/NuGet.Config (Mac/Linux) is used.

  • -ForceEnglishOutput

    (3.5 +) 使用固定的、基于英语的区域性强制运行 nuget.exe。(3.5+) Forces nuget.exe to run using an invariant, English-based culture.

  • -?|-help

    显示命令的帮助信息。Displays help information for the command.

  • -IncludeDelisted

    (3.2 +) 显示未列出的包。(3.2+) Display unlisted packages.

  • -NonInteractive

    禁止提示用户输入或确认。Suppresses prompts for user input or confirmations.

  • -PreRelease

    在列表中包括预发行程序包。Includes prerelease packages in the list.

  • -Source

    要搜索的包源。The package source to search. 可以使用选项多次指定多个源 -SourceYou can specify multiple sources by using the -Source option multiple times.

  • -Verbosity [normal|quiet|detailed]

    指定在输出中显示的详细信息的数量: normal (默认) 、 quietdetailedSpecifies the amount of detail displayed in the output: normal (the default), quiet, or detailed.

另请参阅 环境变量Also see Environment variables


列出配置的源中的所有包:List all packages from configured feeds:

nuget list

列出与 Azure 相关的包,详细详细说明:List Azure-related packages with detailed verbosity:

nuget list Azure -Verbosity detailed

列出来自配置的源的 Azure 相关包的所有版本:List all versions of Azure-related packages from configured feeds:

nuget list Azure -AllVersions

列出指定源/源中与 JSON 相关的所有包的所有版本:List all versions of JSON-related packages from specified source/feed:

nuget list JSON -AllVersions -Source "https://nuget.org/api/v2"

列出来自多个源/源的 JSON 相关包:List JSON-related packages from multiple sources/feeds:

nuget list JSON -Source "https://nuget.org/api/v2" -Source "https://other-feed-url-goes-here"