As of now (02-17-2023), the default Ubuntu 20.04 (and higher) repository version of mono-complete 6.8 on the Raspberry Pi version of Ubuntu Server, doesn’t include msbuild, mono-roslyn, etc., so adding the mono repo to apt must be done if you want to use msbuild instead of the deprecated xbuild.
In this tutorial we will securely add the Official mono repository to our Ubuntu 20.04 Server on the Raspberry Pi 4. This will allow us to use msbuild and mono-rosyln on Ubuntu 20.04.
STEP 1) Add the Official mono gpg signing key to Ubuntu 20.04 “THE RIGHT WAY”, using the gpg
method instead of using the deprecated apt-key
method (this doesn’t need to be done on Ubuntu 18 or lower).
wget -O - https://download.mono-project.com/repo/xamarin.gpg | gpg --dearmor | sudo tee /etc/apt/keyrings/xamarin-mono-archive.gpg >/dev/null
STEP 2) Add the Official Mono repository sources.list
to /etc/apt/sources.list.d/
echo "deb [signed-by=/etc/apt/keyrings/xamarin-mono-archive.gpg] https://download.mono-project.com/repo/ubuntu stable-focal main" \
| sudo tee /etc/apt/sources.list.d/mono-official-stable.list
STEP 3) Update apt and install mono-complete
sudo apt update && sudo apt install mono-complete
ALL DONE! Now you have the mono-complete package on your Ubuntu Raspberry Pi with msbuild and mono-roslyn included.