5

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.
Evan Carroll
  • 78,363
  • 46
  • 261
  • 468

1 Answers1

7

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.

pmcilreavy
  • 3,076
  • 2
  • 28
  • 37
  • 1
    Beautiful *"Add reference to the project."* apparently means download and install from a remote repository.. `npm install`, `cpanm --install` `pip install` `gem install`. Microsoft.. *"add reference to the project."* – Evan Carroll Dec 29 '17 at 07:33
  • `notepad yourproject.csproj`. Ow, and don't forget Ctrl-S when you are done ! – Pac0 Dec 29 '17 at 07:37