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
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}
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"
This allows tools like
dotnet watch
ordotnet ef
to be available globallyAlthough 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 .
Top comments (3)
Thank you so much for the help @alexandrunastase ! I installed the .NET 5.0 SDK tarball on Solus Linux, and then used your export commands to get it working. :D
Im in the same escenario, but i need the SDK 3.0, the problem is that the default runtime installed is 3.1, i need as default runtime the 3.0.. what can i do?
Sorry for the super late reply. Didn't get any notification from dev.to.
I think the only way to fix it is to remove 3.1 as long as you want to use 3.0. On other distros multiple versions are supported at the same time, but Manjaro doesn't have official support.
Keep in mind though that 3.0 ran out of support in '2020-03-03' : dotnet.microsoft.com/download/dotn...