3

I have WSL 18.04 (Ubuntu) and I want to use NuGet.exe to install a Nuget Package to a folder (not .csproj) using the code below:

nuget install Test.Nuget.Version -OutputDirectory packages

In WSL, I use sudo apt install nuget. However that will only install an old nuget version 2.8.xxx in Ubuntu. =(

In order to run nuget install command, I must use the latest version of NuGet version (5.x.x) installed in Ubuntu.

Is it possible to install latest NuGet version in Ubuntu? If yes, how can I do so?

TooTone
  • 7,129
  • 5
  • 34
  • 60
Unknown
  • 778
  • 1
  • 7
  • 16

1 Answers1

1

Normally you can get nuget to update itself:

nuget.exe update -self

However recently, because I assume they have updated the min TLS version, one can get the following error:

The authentication or decryption has failed.
  Error while sending TLS Alert (Fatal:InternalError): System.IO.IOException:

So your nuget version has to be new enough to upgrade itself.

So you have to get a new nuget.exe by alternative means:

curl https://dist.nuget.org/win-x86-commandline/latest/nuget.exe -o nuget.exe

UPDATE: a few years latter the latest nuget.exe doesn't work on 18.04, (likely not compatible with the system mono)

The last one to work is 5.2.1:

curl https://dist.nuget.org/win-x86-commandline/v5.2.1/nuget.exe -o nuget.exe

Note you will likely also have to chmod +x nuget.exe

Tom
  • 6,325
  • 4
  • 31
  • 55