小匕首-dotnet cli使用nuget指令

美男子玩编程

共 2421字,需浏览 5分钟

 · 2022-04-15

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

一、指令清单

输入指令dotnet nuget -h

 >dotnet nuget -h
 NuGet Command Line 6.0.0.129
 
 Usage: dotnet nuget [options] [command]
 
 Options:
   -h|--help Show help information
   --version Show version information
 
 Commands:
  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 -h
 
 Usage: dotnet nuget list [options] [command]
 
 Options:
   -h|--help Show help information
 
 Commands:
  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 -h
 
 
 Usage: dotnet nuget disable [options] [command]
 
 Options:
   -h|--help Show help information
 
 Commands:
   source 禁用 NuGet 源。
 
 Use "disable [command] --help" for more information about a command.

启用配置源

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

启用/停用目标源

 >dotnet nuget disable source  -h
 
 
 Usage: 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  -h
 
 
 Usage: 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 的包源。


往期推荐


点击阅读原文,更精彩~
浏览 15
点赞
评论
收藏
分享

手机扫一扫分享

举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

举报