Upgrading .NET SDK to 3.0 in Arch Linux

Published on

If you’re a .NET developer you are probably aware of the recent release of .NET Core 3.0. TODO: add more here. I wanted to upgrade my Arch machine with the new version but the [package] for dotnet-sdk in the Arch repository was still for version 2.2.6. Similarly the official Microsoft guides for installing the .NET Core SDK on Linux doesn’t provide a guide for Arch so you’re left with download the binary and installing it yourself. Luckly it’s not a very complicated task to do. This post will guide you through the process for upgrading your dotnet-sdk on your Arch machine to version 3.0.

Where is .NET Installed on Linux

First, I think its important to quickly understand how the dotnet is installed on Linux. If you open a terminal window and type which dotnet you’ll receive the path to the executable script (/usr/bin/dotnet). If we quickly cat the content of this script, cat /usr/bin/dotnet, we will see that it simply runs the dotnet binary in /opt/dotnet/.

#!/bin/sh

export DOTNET_ROOT=/opt/dotnet
exec /opt/dotnet/dotnet "$@"

# vim: ts=2 sw=2 et:

So all we really need to do is replace the old sdk directory, /opt/dotnet/, with the new SDK downloaded from the Microsoft download page.

Upgrading the SDK to Version 3.0

# Move or Delete the old version of dotnet in `/opt/` and make a new directory for the new version
sudo mv /opt/dotnet /opt/dotnet-2.2.6
sudo mkdir /opt/dotnet

# Download the tar.gz file
wget https://download.visualstudio.microsoft.com/download/pr/886b4a4c-30af-454b-8bec-81c72b7b4e1f/d1a0c8de9abb36d8535363ede4a15de6/dotnet-sdk-3.0.100-linux-x64.tar.gz

# Extract the contents of the tar.gz into the newly created directory
sudo tar xvf dotnet-sdk-3.0.100-linux-x64.tar.gz -C /opt/dotnet

# Confirm that you're running version 3.0
dotnet --version

You should now running version 3.0. If you have any dotnet tool extensions installed, such as Entity Framework, these will have to be updated as well. All you really have to do is uninstall and reinstall the tool to update to the 3.0 version.

dotnet tool uninstall --global <TOOL-NAME>
dotnet tool install --globla <TOOL-NAME>

 

comments powered by Disqus