您的位置:首页 >聚焦 >

小匕首-dotnet cli使用nuget指令

2022-04-15 20:08:15    来源:程序员客栈

点击上方蓝色字体,关注我们

一、指令清单

输入指令dotnet nuget -h

>dotnet nuget -hNuGet Command Line 6.0.0.129Usage: dotnet nuget [options] [command]Options: -h|--help  Show help information --version  Show version informationCommands:  add    添加 NuGet 源。  delete  从服务器删除一个包。  disable  禁用 NuGet 源。  enable  启用 NuGet 源。  list   列出配置的 NuGet 源。  locals  清除或列出本地 NuGet 资源,例如 http 请求缓存、包文件夹、插件操作缓存或计算机范围全局包文件夹。  push   将包推送到服务器并发布。  remove  移除 NuGet 源。  sign   使用指定的证书对  处的 NuGet 包进行签名。  trust   管理受信任的签名人。  update  更新 NuGet 源。  verify  验证已签名的 NuGet 包。Use "dotnet nuget [command] --help" for more information about a command.

二、获取配置源

列出配置的 NuGet源:

>dotnet nuget list -hUsage: dotnet nuget list [options] [command]Options: -h|--help  Show help informationCommands:  client-cert  列出配置中的所有客户端证书。 source    列出所有配置的 NuGet 源。

查看本地数据源source:

>dotnet nuget list source注册的源: 1.  nuget.org [已启用]    https://api.nuget.org/v3/index.json 2.  Osharp [已禁用]    D:\Program Files\Nuget\Osharp\nupkgs 3.  Microsoft Visual Studio Offline Packages [已禁用]    C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\

三、启用/禁用配置源

禁用配置源

>dotnet nuget disable -hUsage: dotnet nuget disable [options] [command]Options: -h|--help  Show help informationCommands: source  禁用 NuGet 源。Use "disable [command] --help" for more information about a command.

启用配置源

>dotnet nuget enable -hUsage: dotnet nuget enable [options] [command]Options: -h|--help  Show help informationCommands: source  启用 NuGet 源。Use "enable [command] --help" for more information about a command.

启用/停用目标源

>dotnet nuget disable source -hUsage: dotnet nuget disable source [arguments] [options]Arguments:  name  源的名称。Options: --configfile  NuGet 配置文件。如果指定,将仅使用此文件中的设置。如果未指定,则将使用当前目录中的配置文件的层次结构。有关详细信息,请参阅 https://docs.microsoft.com/nuget/consume-packages/configuring-nuget-behavior。 -h|--help   Show help information

>dotnet nuget enable source -hUsage: dotnet nuget enable source [arguments] [options]Arguments:  name  源的名称。Options: --configfile  NuGet 配置文件。如果指定,将仅使用此文件中的设置。如果未指定,则将使用当前目录中的配置文件的层次结构。有关详细信息,请参阅 https://docs.microsoft.com/nuget/consume-packages/configuring-nuget-behavior。 -h|--help   Show help information

操作案例

>dotnet nuget disable source  nexus-server已成功禁用名称为 nexus-server 的包源。

往期推荐

我为什么离开北京

和12岁小同志搞创客开发:有意思的激光切割技术

Python Qt GUI设计:窗口布局管理方法【强化】(基础篇—6)

点击阅读原文,更精彩~

关键词: 配置文件 层次结构 详细信息

相关阅读