Developing .NET Applications on Linux

In this post, we’re going to see how to develop .NET applications within the Linux environment. 

Honestly, until the other day, I hadn’t even considered migrating from Windows to Linux, since it was completely impossible to run .NET applications on Linux until recently.

 

With this post, I want to explain my reasons for considering migrating to Linux, and also show different alternatives for those of you who don’t have any experience with Linux. 

 

 

Before starting, keep in mind that as of today (June 2021), my main computer still runs Windows, and the code examples and screenshots are from a virtual machine. 

 

 

1 - Why Linux?

linux distros

Using Linux comes with a series of advantages over other operating systems:

1.1 - Privacy on Linux as a Desktop OS

Everyone knows that both Windows and MacOS tend to share information from the device as well as how we use it. It’s understandable that many people value their privacy and don’t want to be constantly monitored.

So taking the leap and moving to Linux for this reason is entirely respectable. 

 

By the way, the information that gets shared includes your browser searches, your geolocation, what you say when a mic is nearby, what you watch or listen to; Windows even has a keylogger installed by default. We’re not only sharing information when we get a blue screen or something – it happens all the time. 

Of course, all this information is collected by default and must be manually deactivated.

  • In this link you can find more information 

 

Note: Some Linux distributions also collect data, but you can disable it and be 100% sure it’s off because the code is open source. 

 

1.2 - Reliability of Linux as a Desktop OS

If there’s a reason why servers run on Linux, it's not just because licenses are free, but because they’re more reliable and robust. You’ll see barely any crashes, if any at all. The vast majority of servers in the world run Linux: Facebook, Apple, Amazon, or netmentor, we use Linux on our servers.

Personally, I used Linux as my desktop OS for years and never had issues in this respect.

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

 

1.3 - Security on Linux as a Desktop OS

Generally, Linux is much more secure than Windows, and this is for two main reasons. 

First, there are far fewer Linux users than Windows users, so hackers don’t bother putting their efforts into hacking Linux machines, especially since the average Linux user knows what they’re doing. 

Even though lately we’re seeing more Linux machines in universities or public buildings because they don’t require licenses, hackers don’t usually target Linux users, at least for now. 

 

As a final point, since Linux is open source, many more people are willing to look at the code to fix any security issues. 

On Windows or Mac, we have to wait for their respective teams to fix things, and since there are fewer people, it can take quite a while. 

 

On June 8, 2021, Microsoft fixed 6 bugs, including 6 zero day bugs, vulnerabilities that have been there since day one. Of course, some hackers had found them previously 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 work much better.

 

1.5 - Customizable

Linux, especially some distributions, is 100% customizable. What does that mean? That if you want your windows to have no maximize button on programs, you can remove it; if you want to change the theme, you can do it, whatever you want, even change the whole OS theme naturally. There are several like 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, which is why Windows eventually included wsl2 in its OS.

 

The same goes for the terminal. In the last year, Microsoft has introduced a new terminal, which is practically on par with Linux’s.

terminal windows

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

On Linux, you do it with a single command in the command line and that’s it. 

 

1.7 - Games

If you want to play games, forget about Linux. Despite Linux supporting some games, it doesn’t support most, and you can forget about the major titles. So if you want to play, Windows is your friend.

 

 

2 - Which Linux distribution should I choose for programming?

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

A - Experience Level with Linux

It’s really important to keep in mind that most actions you’ll be doing, especially after first installing the software, will be via command line.

 

There are distros like Ubuntu where you’ll rarely need to use the command line, as it’s meant as an open source alternative to desktop OSes like Windows or Mac OS (as advertised on their site). And if it’s your first time on Linux, you’ll probably want to choose Ubuntu.

 

On the other hand, there are others, like Arch Linux, where you get a bare kernel and must install everything manually.

 

There are hundreds of distributions, and everyone prefers something different, so here’s a link with an image that shows all the distributions and their branches

 

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

It’s worth mentioning that all commands that work on Arch work on Manjaro, since it has access to what is called the “Arch user repository.” That said, keep in mind all packages are open source, created by the community, and are unofficial, so be careful with what you install. 

But in general, if something’s popular and has lots of stars, you shouldn’t worry about security.

 

B - Community

It’s important that the distribution you choose has an active community maintaining it regularly. There’s no point in installing a distribution that hasn’t seen an update in two or three years, there’s no benefit to using it.

 

In the case of Manjaro, they introduce all updates from ArchLinux daily, test them, and then push them to the official image. With what’s called a “rolling release,” they get applied on your computer, there aren’t formal releases like in other distributions. 

manjaro rolling release

 

2.1 - Popular Linux Distributions

With that in mind, here are some Linux distributions worth mentioning:

  • Arch Linux for advanced users who want to build their system from scratch, as it comes with no graphical interface, no file manager, etc. 
  • Manjaro, a fork of Arch Linux that comes with a graphical interface and is ready to use.
  • Ubuntu, possibly the most famous distribution, has full functionality, supports apps like text editors (office), and has the largest community behind it.
  • Fedora is also becoming popular as an everyday workstation.
  • Linux Mint comes with a pre-installed interface similar to Windows (Cinnamon) and is a fork of Debian. Used by Eliot in Mr. Robot for day-to-day work. 
  • Kali Linux: If you’re a hacker (or want to learn about security), you should probably use Kali Linux, as it comes with lots of penetration testing software pre-installed; by the way, that’s the distro they use in Mr. Robot when they do hacking. 

eliot kali linux

There’s a website called DistroTest where you can try different Linux versions and see various desktop layouts to help you choose among the hundreds available. 

 

 

3 - Installing the .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 what I’ve chosen for myself, and Ubuntu is the most common.

I’ll also assume you’ve already installed the OS, drivers, etc., needed on your device.

 

On Manjaro, we’ll use pacman as our package manager, while on Ubuntu we’ll use apt-get.

 

3.1 - Installing .NET on Linux

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

The steps are the same as 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, you can install Git and clone a GitHub repo to check that everything works correctly. In my case, I cloned my repo on RailWay Oriented Programming and ran the tests:

dotnet test en linux

 

3.2 - Installing an IDE for .NET Development on Linux

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

 

But personally, I don’t feel that VSCode or OOS Code is a complete IDE for working with .NET; they work well, but if you have the chance, it’s better to use a proper IDE.

 

Visual Studio is not available for Linux, not in any edition, so we’ll go with a piece of software that, even though it’s paid, is very powerful: JetBrains Rider.

  • Note: JetBrains does not sponsor this post, what I show below is a personal recommendation.

 

3.3 - Jetbrains Rider

Personally, I was pleasantly surprised to see that Rider works on Linux as well as it does on Windows and Mac, since I currently use Rider in my day-to-day work and used it on Mac while studying a few years ago.

 

One of the benefits of using Rider is that the interface is the same across platforms, and you can export or import your settings from one to another.

With powerful features like code analysis, debugging, testing, code coverage (with the dotnet package), support for Unity, web, Xamarin, AWS, etc. 

Plus, the interface is very similar across their products, they have IDEs for Java, Python, Scala, Rust, Go, and so on. 

 

The only thing to keep in mind is that it requires a paid subscription. A Rider subscription costs €139 annually; the all-in-one .NET package (includes Rider, ReSharper, DotTrace, DotCover, DotMemory for memory troubleshooting) costs €149, but after the second year, renewal is only €89.

A totally affordable price for your boss if you’re at a company.

 

The good news is, if you’re a student, you get a full license for all their products, not just Rider. You can request your student license at this link.

  • Note: you have to renew it yearly.

educational license rider

 

3.4 - Installing JetBrains Rider on Linux

JetBrains gives us a very simple method to download and install Rider on Linux.

 

3.4.1 - Prerequisites

But first, make sure you’ve installed both the runtime and SDK for .NET as described in section 3.1. 

Then install mono.

 

3.4.1.1 - Installing Mono on Manjaro (Arch Linux)

Just run the following command: 

sudo pacman -S mono 

 

3.4.1.2 - Installing Mono on Ubuntu

On Ubuntu it’s a little longer, but also just two commands. The first adds the repository:

sudo apt install gnupg ca-certificates
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb https://download.mono-project.com/repo/ubuntu stable-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
sudo 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 JetBrains tools, which is an application with links to download and install the various JetBrains software.

But for our use 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 the following link.

 

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

 

After that, go to the bin folder and run Rider.sh.

This way, you’ll have Rider installed and can access it from your main OS menu.

rider isnstalled in manjaro

 

3.4.2.1 - Installing Rider on Ubuntu

On Ubuntu, this step is easier since JetBrains has included Rider as a snap package, so you just have to run one command.

sudo snap install rider --classic

 

3.5 - Running Rider on Linux

After installing, you can launch it and see everything works perfectly.

rider debug linux

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

 

 

Conclusion

  • In this post we’ve looked at several compelling reasons to use Linux instead of Windows or Mac.
  • A brief overview of various Linux distributions
  • How to configure our development environment on Linux for .NET development

 

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

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

Buy me a coffee Invitame a un café