Skip to main content

Install .NET Core 3.1 SDK on Ubuntu 18.04 inside WSL

I’m a big fan of WSL (Windows Subsystem for Linux) to test my .NET Core applications on Linux.

Recently I tried to install the .NET Core 3.1 SDK on my Ubuntu distribution inside WSL:

bawu@ORD02476:~$ sudo apt-get install dotnet-sdk-3.1

Reading package lists... Done

Building dependency tree

Reading state information... Done

E: Unable to locate package dotnet-sdk-3.1

E: Couldn't find any package by glob 'dotnet-sdk-3.1'

E: Couldn't find any package by regex 'dotnet-sdk-3.1'

This didn’t seem to work. He couldn’t find the .NET Core 3.1 SDK inside the package manager.

I first tried to refresh the packages list:

bawu@ORD02476:~$ sudo apt update

0% [Connecting to archive.ubuntu.com] [Connecting to security.ubuntu.com]

Hit:1 http://archive.ubuntu.com/ubuntu bionic InRelease

Get:2 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]

Get:3 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]

Get:4 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]

Get:5 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages [8570 kB]

Get:6 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages [593 kB]

Get:7 http://security.ubuntu.com/ubuntu bionic-security/main Translation-en [194 kB]

Get:8 http://security.ubuntu.com/ubuntu bionic-security/restricted amd64 Packages [15.1 kB]

Get:9 http://security.ubuntu.com/ubuntu bionic-security/restricted Translation-en [4684 B]

Get:10 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [627 kB]

Get:11 http://security.ubuntu.com/ubuntu bionic-security/universe Translation-en [210 kB]

Get:12 http://security.ubuntu.com/ubuntu bionic-security/multiverse amd64 Packages [6120 B]

Get:13 http://security.ubuntu.com/ubuntu bionic-security/multiverse Translation-en [2600 B]

Get:14 http://archive.ubuntu.com/ubuntu bionic/universe Translation-en [4941 kB]

Get:15 http://archive.ubuntu.com/ubuntu bionic/multiverse amd64 Packages [151 kB]

Get:16 http://archive.ubuntu.com/ubuntu bionic/multiverse Translation-en [108 kB]

Get:17 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [817 kB]

Get:18 http://archive.ubuntu.com/ubuntu bionic-updates/main Translation-en [288 kB]

Get:19 http://archive.ubuntu.com/ubuntu bionic-updates/restricted amd64 Packages [24.1 kB]

Get:20 http://archive.ubuntu.com/ubuntu bionic-updates/restricted Translation-en [6620 B]

Get:21 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [1033 kB]

Get:22 http://archive.ubuntu.com/ubuntu bionic-updates/universe Translation-en [319 kB]

Get:23 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 Packages [9284 B]

Get:24 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse Translation-en [4508 B]

Get:25 http://archive.ubuntu.com/ubuntu bionic-backports/main amd64 Packages [2512 B]

Get:26 http://archive.ubuntu.com/ubuntu bionic-backports/main Translation-en [1644 B]

Get:27 http://archive.ubuntu.com/ubuntu bionic-backports/universe amd64 Packages [4028 B]

Get:28 http://archive.ubuntu.com/ubuntu bionic-backports/universe Translation-en [1856 B]

Fetched 18.2 MB in 27s (661 kB/s)

Reading package lists... Done

Building dependency tree

Reading state information... Done

131 packages can be upgraded. Run 'apt list --upgradable' to see them.

But this didn’t made any difference:

bawu@ORD02476:~$ apt search dotnet-sdk

Sorting... Done

Full Text Search... Done

The trick is to first let the package manager know that it should include packages from ‘packages.microsoft.com’:

bawu@ORD02476:~$ wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb

bawu@ORD02476:~$ sudo dpkg -i packages-microsoft-prod.deb

Selecting previously unselected package packages-microsoft-prod.

(Reading database ... 28645 files and directories currently installed.)

Preparing to unpack packages-microsoft-prod.deb ...

Unpacking packages-microsoft-prod (1.0-ubuntu18.04.2) ...

Setting up packages-microsoft-prod (1.0-ubuntu18.04.2) ...

If we now update the package manager, it reads the packages from Microsoft as well:

bawu@ORD02476:~$ sudo apt-get update

Hit:1 http://archive.ubuntu.com/ubuntu bionic InRelease

Hit:2 http://archive.ubuntu.com/ubuntu bionic-updates InRelease

Get:3 https://packages.microsoft.com/ubuntu/18.04/prod bionic InRelease [4003 B]

Hit:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease

Hit:5 http://security.ubuntu.com/ubuntu bionic-security InRelease

Get:6 https://packages.microsoft.com/ubuntu/18.04/prod bionic/main amd64 Packages [85.1 kB]

Fetched 89.1 kB in 14s (6320 B/s)

Reading package lists... Done

And finally we find the .NET Core SDK when searching for packages:

bawu@ORD02476:~$ apt search dotnet-sdk

Sorting... Done

Full Text Search... Done

dotnet-sdk-2.1/bionic 2.1.802-1 amd64

  Microsoft .NET Core SDK 2.1.802

dotnet-sdk-2.1.105/bionic 2.1.105-1 amd64

  Microsoft .NET Core SDK - 2.1.105

dotnet-sdk-2.1.200/bionic 2.1.200-1 amd64

  Microsoft .NET Core SDK - 2.1.200

dotnet-sdk-2.1.201/bionic 2.1.201-1 amd64

  Microsoft .NET Core SDK - 2.1.201

dotnet-sdk-2.1.202/bionic 2.1.202-1 amd64

  Microsoft .NET Core SDK - 2.1.202

dotnet-sdk-2.1.300-preview2-008533/bionic 2.1.300-preview2-008533-1 amd64

  Microsoft .NET Core SDK 2.1.300 - Preview

dotnet-sdk-2.1.300-rc1-008673/bionic 2.1.300-rc1-008673-1 amd64

Microsoft .NET Core SDK 2.1.300 - rc1

dotnet-sdk-2.2/bionic 2.2.402-1 amd64

  Microsoft .NET Core SDK 2.2.402

dotnet-sdk-3.0/bionic 3.0.101-1 amd64

  Microsoft .NET Core SDK 3.0.101

dotnet-sdk-3.1/bionic 3.1.100-1 amd64

Microsoft .NET Core SDK 3.1.100

Popular posts from this blog

Azure DevOps/ GitHub emoji

I’m really bad at remembering emoji’s. So here is cheat sheet with all emoji’s that can be used in tools that support the github emoji markdown markup: All credits go to rcaviers who created this list.

Kubernetes–Limit your environmental impact

Reducing the carbon footprint and CO2 emission of our (cloud) workloads, is a responsibility of all of us. If you are running a Kubernetes cluster, have a look at Kube-Green . kube-green is a simple Kubernetes operator that automatically shuts down (some of) your pods when you don't need them. A single pod produces about 11 Kg CO2eq per year( here the calculation). Reason enough to give it a try! Installing kube-green in your cluster The easiest way to install the operator in your cluster is through kubectl. We first need to install a cert-manager: kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.14.5/cert-manager.yaml Remark: Wait a minute before you continue as it can take some time before the cert-manager is up & running inside your cluster. Now we can install the kube-green operator: kubectl apply -f https://github.com/kube-green/kube-green/releases/latest/download/kube-green.yaml Now in the namespace where we want t

DevToys–A swiss army knife for developers

As a developer there are a lot of small tasks you need to do as part of your coding, debugging and testing activities.  DevToys is an offline windows app that tries to help you with these tasks. Instead of using different websites you get a fully offline experience offering help for a large list of tasks. Many tools are available. Here is the current list: Converters JSON <> YAML Timestamp Number Base Cron Parser Encoders / Decoders HTML URL Base64 Text & Image GZip JWT Decoder Formatters JSON SQL XML Generators Hash (MD5, SHA1, SHA256, SHA512) UUID 1 and 4 Lorem Ipsum Checksum Text Escape / Unescape Inspector & Case Converter Regex Tester Text Comparer XML Validator Markdown Preview Graphic Color B