Unable to locate package dotnet-sdk-3.1

Every time there is a new release of dotnetcore I need to get it updated on the three environments where I develop and deploy code: macOS, Windows and Linux (Ubuntu).

Homebrew and Chocolatey update the version of dotnetcore for me automatically, sometimes there is a delay but they will eventually update them.

However, for Linux each release of dotnetcore I always have to manually intervene and install it manually.

If you follow the instructions from Microsoft you will get the following error message:

Unable to locate package dotnet-sdk-3.1

The issue is that page targets Ubuntu version 19.04 and I am running Ubuntu version 19.10 (Eoan Ermine).

So, If you are me from the future wanting to know how to get the latest version installed here is what you need to do:

curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
sudo apt-add-repository https://packages.microsoft.com/ubuntu/19.10/prod
sudo apt-get update
sudo apt-get install dotnet-sdk-3.1

Success 🎉