Skip to content
Advertisement

How do I download a package from the command line with .NET Core from nuget?

Microsoft packages .NET Core on Linux for Ubuntu. I’m currently using that. I now want to install Json.NET which instructs me to use the Package Manager console and run,

PM> Install-Package Newtonsoft.Json

I’m wondering how I do that Linux. I see that there is a Nuget CLI, but it doesn’t seem like that’s available on .NET Core. Moreover the docs say

On Mac and Linux, install Mono 4.4.2 or later.

How do I simply install a package on Linux? What’s the .NET equivalent of npm/cpan/pip/gem?

When I run dotnet nuget, the install command seems to be missing.

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.

Advertisement

Answer

dotnet add package --help

dotnet add package Newtonsoft.Json

Please refer to the github page https://github.com/dotnet/docs/blob/master/docs/core/tools/dotnet-add-package.md for more details.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement