3

I've been trying to download netcore 2.2 on ubuntu, Ive tried with apt and I have no luck I get the package not found error.

I also tried downloading the binaries and registering the path but it doesn't seem to work. Is it just not possible at all?

3 Answers3

3

.NET Core 2.2 was End of Life'd in Dec 2019. So Microsoft doesn't produce packages .NET Core 2.2 for recent versions of Linux distributions, including Ubuntu 20.04. Only 2.1 and 3.1, the currently supported versions, are available for Ubuntu 20.04.

If you want to install them, you should try a manual install:

  1. Go to the main download site: https://dotnet.microsoft.com/download/dotnet-core

  2. Click "Out of support versions". That should show you a table. Click on 2.2, which should take you to: https://dotnet.microsoft.com/download/dotnet-core/2.2

  3. Click on the "x64" under the "Binaries" table of the release: https://dotnet.microsoft.com/download/dotnet-core/thank-you/sdk-2.2.207-linux-x64-binaries

  4. Follow the steps on that page to extract the downloaded tarball and "install" it:

    mkdir -p $HOME/dotnet && tar xf dotnet-sdk-2.2.207-linux-x64.tar.gz -C $HOME/dotnet
    export DOTNET_ROOT=$HOME/dotnet
    export PATH=$PATH:$HOME/dotnet
    

I am going to repeat the warnings you will see on the download site: This is an old version of .NET Core which has many unpatched security vulnerabilities that are now public. You do not want to deploy an application to production using .NET Core 2.2. Upgrade to 3.1 or downgrade to 2.1 instead.

omajid
  • 9,528
  • 3
  • 37
  • 52
  • 1
    In my scenario, I copy extracted archive(host, sdk, shared) into my dotnet shared folder in `/usr/share/dotnet`. (on Ubuntu 20.04) – Soren Jan 31 '21 at 09:40
1

In my case, I already had versions installed through APT.

As I had to work on some projects that still use .NET Core 2.2, I just copied the contents of the $HOME/dotnet/sdk/2.2.207 (this version may be different on your machine) and $HOME/dotnet/shared/* folders to /usr/share/dotnet.

With bash, I've used this commands:

sudo cp -r ~/dotnet/sdk/2.2.207/ /usr/share/dotnet/sdk/
sudo cp -r ~/dotnet/shared/* /usr/share/dotnet/shared/
0

First must read very very clear answer for @amajid.

About point #4 In case you already install another SDKs like Dotnet SDK 3.1 or 2.1 (supported SDKs on Ubuntu 20.04), you can install manual Dotnet SDK 2.2 on the default location of another SDKs [under /usr/share/dotnet folder] like comment under @omajid answer by @Soran

sudo tar xf dotnet-sdk-2.2.207-linux-x64.tar.gz -C /usr/share/dotnet

after extract Dotnet SDK Must make sure all folders and files with root user and root group

sudo chown -R root /usr/share/dotnet
sudo chgrp -R root /usr/share/dotnet 

Finally I would like to mention about installing Dotnet SDK 2.2 on Ubuntu 20.04 manually will complete and work But you will face some problems (which I already faced)

1- You not able to Run Publish command with Ubuntu 20.04 Runtime as framework not support this runtime

 dotnet publish -c Release -r ubuntu.20.04-x64 --self-contained

2- You face problem on Permission denied error on NuGetFallbackFolder file every you use dotnet command, Github issue

ahmed hamdy
  • 4,556
  • 1
  • 44
  • 52