Paul's Blog

A collection of notes and stuff I find interesting

Installing .NET on Ubuntu

2023-09-09 1 min read Code snippets

Installing .NET on Ubuntu is supposed to be easy. Sometimes it’s not. You should be able to follow the instructions on the Microsoft docs and install from a package manager but I’ve had issues with that. It’s been a frustrating experience; the package installs but then I can’t run dotnet --version and I can’t figure out why.

Thankfully there is an option to manually install .NET, this is what I’ve had the most success with.

Here’s a script that I use to install .NET on Ubuntu:

# get the install script
wget -O

# make it executable
chmod +x ./

# run the script

# remove the script
rm ./

# add .dotnet to your path.
# note: im using zsh, if you're using bash you'll need to add this to your .bashrc
echo 'export PATH=$PATH:$HOME/.dotnet' >> ~/.zshrc

# reload your shell
source ~/.zshrc

Now you should be able to run dotnet --version and see the version of .NET that you installed 🎉