Developing .NET Applications on Linux

In this post, we'll look at how to develop .NET applications within the Linux environment. 

I have to admit, until recently I had never even thought about migrating from Windows to Linux, since for a long time it was completely impossible to run applications written in .NET on linux.

 

With this post, I want to explain my reasons for considering migrating to Linux, as well as to show different alternatives for those of you who don't have experience with Linux. 

 

 

Before we start, I'll mention that as of today (June 2021) my main machine still runs Windows, and the code examples and screenshots are from a virtual machine. 

 

 

1 - Why Linux?

linux distros

Using Linux brings a series of advantages compared to other operating systems:

1.1 - Privacy in Linux as a desktop OS

Everybody knows that both Windows and macOS are quite keen on sharing information from your device, as well as your usage. It's understandable that many people value their privacy and don't want to be constantly spied on.

So making the move to Linux for this reason is totally legitimate. 

 

By the way, the information shared ranges from your browser searches, your geolocation, what you say when you have a mic nearby, what you watch or listen to—even Windows has a keylogger installed by default in the system. We're not just sharing information when we get a blue screen or similar, it's all the time. 

Of course, all this information is collected by default and needs to be manually disabled.

  • You can find more information at this link

 

Note: Some Linux distributions also collect information, but you can disable it and be 100% sure it is actually off, since the code is open-source. 

 

1.2 - Reliability of Linux as a desktop OS

If there's one reason why servers run on Linux, it's not just because the license is free—it's because they're more stable and robust. You will hardly ever see crashes, if any at all. The vast majority of servers in the world run Linux: Facebook, Apple, Amazon, and even netmentor use Linux on their servers.

Personally, I used Linux as my desktop software for many years and never had stability issues.

On Windows… well, who hasn't seen the blue screen?

 

1.3 - Security in Linux as a desktop OS

Generally, Linux is much more secure than Windows, and that's due to two main reasons. 

First, there are far fewer Linux users than Windows ones, so hackers don't bother spending much effort trying to hack Linux machines—plus the average Linux user knows what they're doing. 

Even though we're seeing more and more Linux computers in universities or public buildings lately, because they don't require licenses, hackers don't generally target Linux users, at least not yet. 

 

As a final point, since Linux is open source, a lot more people are willing and able to review the code and fix any security vulnerabilities. 

In Windows or Mac, you have to wait for the team to fix it—and since there are fewer people, it takes more time. 

 

On June 8, 2021, Microsoft fixed 6 bugs, including 6 zero day bugs—vulnerabilities that have existed since day one. Obviously, some hackers had found them years ago and were exploiting them. It took 6 years to find and fix these bugs. 

 

1.4 - Hardware requirements

Generally, Linux distributions require fewer resources than Windows versions, so if you have an old PC, install Linux and it will run much better.

 

1.5 - Customizable

Linux—especially some distributions—is fully customizable. What does this mean? If you want your windows to not have a maximize button, you can remove it; if you want to change the theme, you can do it—whatever you like, including changing the operating system's look and feel very naturally. Popular ones include Gnome 3, KDE Plasma, Cinnamon, and many others.

 

 

1.6 - Package manager & terminal

If we want to install any software, we can do so through the terminal and its package manager. The terminal is very powerful; that's why Windows ended up introducing wsl2 into the operating system.

 

The same goes for the terminal: in the last year, Microsoft introduced their new terminal, which is practically on par with Linux's.

terminal windows

One example where the Linux terminal (and Linux in general) is much more useful is when removing software from the system. When you delete something in Windows, there are always traces left everywhere—files saved here and there automatically and without notice.

In Linux, it's done with a single command in the command line and that's it. 

 

1.7 - Gaming

If you want to play games—forget about Linux. Even though Linux distributions support some games, they support very few, and you can forget about most triple-A titles. So if you want to play, Windows is your friend.

 

 

2 - Which Linux distribution to choose for programming?

Technically, you can use any, but I would choose one based on the following characteristics. 

A - Experience level in Linux

It's very important to consider that most actions you'll need—especially at the beginning when installing software—will be command line based.

 

There are distros like Ubuntu that require little or no command line usage, since it's positioned as an open-source alternative to desktop operating systems like Windows or Mac OS, and that's how it's advertised on their website. If it's your first time with Linux, you should probably choose Ubuntu.

 

On the other hand, there are others, like Arch Linux, that come with a bare kernel and you have to install everything manually.

 

There are hundreds of distributions, and everyone likes something different. Here's a link to an image with all the distributions and their branches:

 

Personally, I chose Manjaro, a fork of Arch Linux with a plasma graphical interface.

It's important to note that all commands working in Arch also work in Manjaro since it has access to what's called the Arch user repository. Keep in mind, though, that all packages are community-created open-source and unofficial, so be cautious with what you install. 

But in general, if something is popular and has lots of stars, you shouldn't have security issues.

 

B - Community

It's important that the distribution you pick has an active community maintaining it. There's no point installing a distribution that hasn't seen updates in two or three years; it's just not worth it.

 

In the case of Manjaro, they introduce all the updates received from ArchLinux every day, test them, and then pass them to the official image. With the so-called rolling release system, updates are applied to your computer automatically—there are no release cycles as there are in other distros. 

manjaro rolling release

 

2.1 - Popular Linux distributions

With that in mind, here are some popular Linux distributions:

  • Arch Linux for advanced users who want to set up everything from scratch—it comes with no graphical interface, no file manager, etc. 
  • Manjaro, a fork of Arch Linux, comes with a graphical interface and is ready to use.
  • Ubuntu, possibly the most famous distribution, is fully featured, supports applications like office editors, and has a large community.
  • Fedora is also gaining a very good reputation for everyday workstations.
  • Linux Mint comes pre-installed with an interface similar to Windows (Cinnamon) and is a Debian fork. Used by Elliot in Mr. Robot for daily use.
  • Kali Linux—if you're a hacker (or want to learn about security) you might want to use Kali Linux, as it comes with lots of penetration testing tools installed. By the way, it's the distro used in Mr. Robot for hacking scenes. 

eliot kali linux

There's a website called DistroTest where you can try different Linux versions and see how the desktops look, to help you choose among the hundreds available. 

 

 

3 - Installing a .NET development environment on Linux

For this post, I'll explain the commands and steps for both Manjaro (Arch Linux) and Ubuntu, since Manjaro is my personal choice and Ubuntu is the most common.

I'll also assume you've already installed the system, drivers, etc. you need on your machine.

 

On Manjaro, we'll use pacman as the package manager, while on Ubuntu, it's apt-get

 

3.1 - Installing .NET on Linux

First of all, in order to develop in .NET, we need to install the SDK and runtime on our machine.

The steps are the same as we saw in the post about deploying a .NET application on CentOS.

 

3.1.1 - Installing .NET on Manjaro (Arch Linux)

From the terminal, install the .NET runtime:

sudo pacman -S dotnet-runtime

Then install the .NET SDK: 

sudo pacman -S dotnet-sdk

 

3.1.2 - Installing .NET on Ubuntu

To install the .NET SDK on Ubuntu, run

sudo apt-get install -y dotnet-sdk-5.0

And the runtime:

sudo apt-get install -y aspnetcore-runtime-5.0

 

Alternatively, we can install Git and clone a GitHub repo to check everything is working correctly. In my case, I cloned my repo about RailWay Oriented Programming and ran the tests:

dotnet test en linux

 

3.2 - Installing an IDE to develop .NET on Linux

We can install Visual Studio Code or OOS - Code, which is the open-source version without proprietary code upon which Visual Studio Code is based.

 

But personally, I don't feel that VSCode or OOS Code are a full IDE for working with .NET—they work fine, but if you have the chance, it's better to use an IDE.

 

Visual Studio is not available for Linux, not in any edition, so we're going to use a paid but very powerful software: JetBrains Rider.

  • Note: JetBrains does not sponsor this post. What I show below is just my personal recommendation.

 

3.3 - JetBrains Rider

I was pleasantly surprised to discover that Rider works perfectly on Linux, just like it does on Windows and Mac. I currently use Rider in my daily work, and I used Rider on Mac a few years ago while studying.

 

One of the benefits of using Rider is that the interface is the same on all platforms, and you can export or import your configuration between them.

With powerful features like code analysis, debugging, running tests, code coverage (with the dotnet package), support for Unity, web, Xamarin, AWS, and more. 

In addition, the interface is very similar in all their products—they've got one for Java, Python, Scala, Rust, Go, etc. 

 

The only catch is that it has a paid subscription. Rider costs €139 per year; the entire .NET pack that includes Rider, ReSharper, DotTrace, DotCover and DotMemory (to help you find memory problems) costs €149, but from the second year on it's just €89/year.

A very affordable price for a company to pay for their developers.

 

The good news is that if you're a student, you get a full license for all their products, not just Rider. You can request your student license here.

  • Note: you have to renew it every year.

educational license rider

 

3.4 - Installing JetBrains Rider on Linux

JetBrains provides a straightforward solution for downloading and installing Rider on Linux.

 

3.4.1 - Prerequisites

First, make sure you have both the runtime and the .NET SDK installed as described in section 3.1. 

Then you'll need to install mono.

 

3.4.1.1 - Installing Mono on Manjaro (Arch Linux)

Just run this command: 

sudo pacman -S mono 

 

3.4.1.2 - Installing Mono on Ubuntu

On Ubuntu, it's a bit longer, but just two commands—the first to add the repository:

sudo apt install gnupg ca-certificatessudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EFecho "deb https://download.mono-project.com/repo/ubuntu stable-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.listsudo apt update

Now install Mono

sudo apt install mono-devel

 

3.4.2 - Installing Rider on Linux

To install Rider on Linux, you can install what are called JetBrains Tools, an application with links to download and install JetBrains software.

But for our case, we just need Rider

 

3.4.2.1 - Installing Rider on Manjaro (Arch Linux)

To install Rider on Manjaro, download the .tar.gz package from this link.

 

Once downloaded, extract it either with the command sudo tar -xzf Rider.tar.gz or by double-clicking the file and extracting it completely.

 

Next, go to the bin folder and run the Rider.sh file.

This will install Rider on your system, and you can access it from the main menu of your operating system.

rider isntalled in manjaro

 

3.4.2.1 - Installing Rider on Ubuntu

On Ubuntu, this step is easier since JetBrains has included it as a snap package, so you just need to run a single command.

sudo snap install rider --classic

 

3.5 - Running Rider on Linux

Once installed, you can run it and see how everything works perfectly.

rider debug linux

In my case, I used the project that we cloned in section 3.1

 

 

Conclusion

  • In this post, we've seen several solid reasons to use Linux instead of Windows or Mac.
  • A quick summary of different Linux distributions
  • How to configure our development environment on Linux to develop in .NET

 

This post was translated from Spanish. You can see the original one here.
If there is any problem you can add a comment bellow or contact me in the website's contact form

Uso del bloqueador de anuncios adblock

Hola!

Primero de todo bienvenido a la web de NetMentor donde podrás aprender programación en C# y .NET desde un nivel de principiante hasta más avanzado.


Yo entiendo que utilices un bloqueador de anuncios como AdBlock, Ublock o el propio navegador Brave. Pero te tengo que pedir por favor que desactives el bloqueador para esta web.


Intento personalmente no poner mucha publicidad, la justa para pagar el servidor y por supuesto que no sea intrusiva; Si pese a ello piensas que es intrusiva siempre me puedes escribir por privado o por Twitter a @NetMentorTW.


Si ya lo has desactivado, por favor recarga la página.


Un saludo y muchas gracias por tu colaboración

© copyright 2025 NetMentor | Todos los derechos reservados | RSS Feed

Buy me a coffee Invitame a un café