Using Linux in a modern .NET world
Tips & tricks for linux users

Because Macbook keyboards need to be repaired from time to time, I was forced to use my — rather old, but still very capable — Acer Aspire V3–571G to continue my .NET development work in the meantime. I gave it a fresh install of the latest Zorin OS 15 Core distro, which is built upon Ubuntu 18.04.2 LTS. I’ll discuss some details on how to get up and running quickly with .NET development on Linux.

This post is a follow up on my previous post, when setting up a Mac for .NET development.

Installing .NET Core SDK on Zorin OS

Nothing special here. You can choose which version you want to install on Microsoft’s download page. I suggest you follow Microsoft’s instructions on where to place your dotnet binaries (home folder in this case). The reason for this location, instead of /opt/dotnet for example, will be explained below.

Getting Sql Server up and running

Same procedure when setting everything up on a Mac: Run a docker image of sql-server. And since docker is originally build for Linux, this should not be an issue! Docker itself can be installed via command line as explained in the official docker documentation. And because Zorin OS is build upon Ubuntu 18.04, you can follow the instructions for this operating system on how to install it.

Azure Data Studio

Microsoft new SqlServer client, called Azure Data Studio, is available cross-platform. Since I already use it with MacOS, there was no need to look for something else. Don’t forget to check the box to “Enable unreleased preview versions” in Settings. This will be necessary if you want to be able to restore a SqlServer database with a *.bak file.

Choosing an IDE

Since I already have a subscription for the cross-platform Rider IDE, I could use the same license to run Rider on Linux. Installing Rider on Linux is a breeze, because they packaged it in a snap-package. Zorin features an easy-to-use software center to install these snap packages. So click & install straight from your desktop!

Zorin Software Center

As a side note, it’s interesting to see the distribution of snap-installs of Rider IDE across different linux distributions on the website of the snap-package. Since Zorin 15 is pretty new, it looks like it has relatively many Rider installs compared to other distributions.

Distribution downloads

Running it all

Both building and running the solution did not give any problems. Everything worked straight from the start. I have to admit that I already made some changes to the codebase to get it up and running on MacOS. And since MacOS and Zorin OS both share a grandparent named ‘Unix’, solving issues to get it running on MacOS also prepared the codebase for Linux distro’s.

Running XUnit tests

The only thing that didn’t go smoothly was getting the tests to run on my system. Upon navigating to the test files. Rider displayed icons which told me Dotnet Core SDK not found, which was odd, because building the solution was not a problem. Upon investigating, I came across the following stackoverflow question. The solution was to install the dotnet binaries in the home folder instead of a default non-home path. So I suspect some accessibility issue on my system was the cause for it. After reinstalling the dotnet SDK in the home folder (as mentioned in the beginning of this post), XUnit was able to detect the dotnet core SDK and was able to run all tests.

Conclusion

All in all, from a Linux OS install to running a dotnet stack went pretty smoothly. Hope this post can help you for preparing your Linux system for dotnet development!

Cheers, Andries.


Last modified on 2019-06-20