How to install .NET core SDK with ASP.NET on Manjaro Linux

alexandrunastase

Alexandru Năstase

Posted on September 26, 2020

How to install .NET core SDK with ASP.NET on Manjaro Linux

I recently switched from Fedora to Manjaro as my main Linux distribution and since I use .NET core from time to time I wanted to install it. It turns out that since at the time of this writing, it's not officially supported, as it was the case with Fedora, there was a bit more trial and error involved in the process.

My first attempt was to try to install it using snap, since it mentions Manjaro in the supported list. I had some issues when I installed it like this, among which the biggest was that the official C# extension in VS Code, OmniSharp, was not working.

The good news is that there are official Arch Linux packages with the .NET Core SDK now.

Steps to install

Install dotnet-sdk with asp.net runtime:

sudo pacman -S dotnet-sdk aspnet-runtime
Enter fullscreen mode Exit fullscreen mode

In order to have the needed environment variables and the dotnet root in PATH, create a/etc/profile.d/dotnet.sh file with the following contents:

export DOTNET_ROOT=/usr/share/dotnet
export MSBuildSDKsPath=$DOTNET_ROOT/sdk/$(${DOTNET_ROOT}/dotnet --version)/Sdks
export PATH=${PATH}:${DOTNET_ROOT}
Enter fullscreen mode Exit fullscreen mode

Note: After this step, a reboot or re-login is required.

Depending on what shell you use, append to the .bashrc or .zshrc configuration files the following:

# Adds dotnet tools to the PATH variable
export PATH="$PATH:/home/[[USER_NAME]]/.dotnet/tools"
Enter fullscreen mode Exit fullscreen mode
  • This allows tools like dotnet watch or dotnet ef to be available globally

  • Although some people suggest also adding DOTNET_CLI_TELEMETRY_OPTOUT=1, I would advice against it for now, given the fact the Arch Linux is not officially supported and Microsoft might also take into account the usage statistics when prioritizing bug fixes or support for certain Linux distributions.

Tested using :

  • Manjaro version: 20.1
  • Kernel version: 5.8.6-1-MANJARO
  • dotnet version: 3.1.107

Links:

If this guide becomes outdated or if you have any issues with the any steps feel free PM me on Twitter .

💖 💪 🙅 🚩
alexandrunastase
Alexandru Năstase

Posted on September 26, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related