如何从nuget的.NET Core命令行下载软件包?

时间:2017-12-29 07:18:08

标签: c# .net linux .net-core .net-core-2.0

Microsoft为Ubuntu打包.NET Core on Linux。我目前正在使用它。我现在要安装Json.NET,指示我使用Package Manager console并运行

PM> Install-Package Newtonsoft.Json

我想知道我是怎么做那个Linux的。我看到有一个Nuget CLI,但它似乎并不像.NET Core上那样可用。 Moreover the docs say

  

在Mac和Linux上,安装Mono 4.4.2或更高版本。

如何在Linux上安装软件包?什么是.NET等价于npm / cpan / pip / gem?

当我运行dotnet nuget时,似乎缺少install命令。

NuGet Command Line 4.3.0.5

Usage: dotnet nuget [options] [command]

Options:
  -h|--help                   Show help information
  --version                   Show version information
  -v|--verbosity <verbosity>  The verbosity of logging to use. Allowed values: Debug, Verbose, Information, Minimal, Warning, Error.

Commands:
  delete  Deletes a package from the server.
  locals  Clears or lists local NuGet resources such as http requests cache, packages cache or machine-wide global packages folder.
  push    Pushes a package to the server and publishes it.

Use "dotnet nuget [command] --help" for more information about a command.

1 个答案:

答案 0 :(得分:4)

dotnet add package --help

dotnet add package Newtonsoft.Json

有关详细信息,请参阅github页面https://github.com/dotnet/docs/blob/master/docs/core/tools/dotnet-add-package.md