I have recently been exploring C# at work and decided to set up a development environment on my personal workstation, which is currently running Manjaro Ornara 21.0.7.

I initially checked the official documentation for installing .NET on Linux but there were no mention of arch-based systems instructions, although it included a snap package as an option for operating systems which were not listed, but I opted not to install it that way in case it doesn’t play well with other development tools. I tend to stay away from snap packages in general anyway.

As a result I chose to install the packages that were needed manually. According to the documentation, all we need to have to build .NET applications is the .NET SDK. The SDK contains all the tools needed to develop applications as well as the runtime, which is needed to run those applications. However in Arch, the SDK and the runtime engine are shipped as separate packages, so we can’t just install the SDK and expect to have a full working setup.

Installing .NET SDK and runtime engines The packages we need are dotnet-sdk, dotnet-runtime and aspnet-runtime. They can be easily installed using pacman:

pacman -S dotnet-sdk dotnet-runtime aspnet-runtime

To verify which SDK and runtimes have been installed, run the following command:

dotnet --list-sdks && dotnet --list-runtimes

Once the packages are installed, check whether the dotnet executable is located at /usr/bin/dotnet by running whereis dotnet, otherwise some issues may arise.

If it’s not located there, create the file /etc/profile.d/dotnet.sh as suggested by this thread and add the following contents:

export DOTNET_ROOT=/opt/dotnet
export MSBuildSDKsPath=$DOTNET_ROOT/sdk/$(${DOTNET_ROOT}/dotnet --version)/Sdks
export PATH=${PATH}:${DOTNET_ROOT}

Then add the following to your bash profile - (~/.bashrc by default) :

export PATH="$PATH:/home/YOUR_USER_NAME/.dotnet/tools"

You should now be able to create and execute .NET apps. To make sure everyting is working properly, let’s initialize a basic .NET app.

Create a new directory for the app, cd into it and run dotnet new console. This will generate a basic hello world console application which includes a Program.cs file.

To run the program generated, run the command:

dotnet run Program.cs

If it outputs Hello World! without any errors then you are good to go!