Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NuGet for .NET Core on Linux

When you do dotnet restore .NET Core quite obviously downloads NuGet packages. But I cannot find a NuGet command line utility for .NET Core (there is one for Mono, but I'm not after that).

So how do you get NuGet to work from the command line with .NET Core on Linux (outside of package restore obviously. That works out of the box).

like image 684
Andrew Savinykh Avatar asked Feb 13 '17 02:02

Andrew Savinykh


People also ask

Does NuGet work on Linux?

The nuget.exe CLI, nuget.exe , is the command-line utility for Windows that provides all NuGet capabilities; it can also be run on Mac OSX and Linux using Mono with some limitations.

Does .NET core use NuGet?

For . NET (including . NET Core), the Microsoft-supported mechanism for sharing code is NuGet, which defines how packages for . NET are created, hosted, and consumed, and provides the tools for each of those roles.


1 Answers

With recent .NET Core SDK releases, such as 1.0.0 RC4, NuGet is shipped with .NET Core. You can directly access NuGet by specifying it as a command with dotnet:

dotnet nuget

If the version of the .NET Core SDK does not support that you could look at downloading a nightly build of NuGet v4. There is a NuGet.CommandLine.Xplat NuGet package which supports being run on .NET Core. However, you need all its dependencies in the same folder and the NuGet package does not specify them. Downloading just the NuGet.CommandLine.Xplat NuGet package will not work directly. It will show an error about missing NuGet assemblies.

Your final option, which you said you did not want to do, is to install Mono.

like image 157
Matt Ward Avatar answered Oct 03 '22 18:10

Matt Ward