I am having fun with Linux Mint. All the modifications options, speed with different apps and workspaces usage is a productivity booster. To start working on my projects in Linux, I need .NET Core installed. Frankly, the only reason for me to ignore Linux in the past, was .NET only on Windows.
Installing .NET on Linux is blunt simple. The documentation site has really good step by step instructions, how to proceed with installation on different Linux distributions.
Since I will be building apps (not just running them), I will install .NET Core (currently version 3.1). Clicking on “Install .NET Core” will automatically redirect you to instructions, how to install it via different package managers for different Linux distributions. Browsing through instructions, Mint is not listed. The instructions for Ubuntu (latest version) should work. Mint is branch of Ubuntu – built on top of Ubuntu LTS to be precise.
As we are installing a package, first step requires from us to add Microsoft registry (storage location from which your system retrieves and installs OS updates and applications) and GPG key (to guarantee the authenticity).
If you want to check, what kind of repositories you have on your machine, you can do that by checking sources.list file (in /etc/apt folder) and /etc/apt/sources.list.d.
If you cat microsoft-prod.list, you will see the repository information for Ubuntu. It is marked with main on the end (prod disco main), which means officialy supported open software.
After completing that step, we can install .NET Core with few common commands (update and install). If you wondering, why you need to add apt-transport-https package, this webpage explains it a little bit more.
When installation is successful, you’ll see the following information:
To be sure, if .NET is installed, you can check basic information (enter dotnet –info in the terminal and press Enter).
or use locate, man or whatis (one liner from manual page) commands to leverage built in options.
Trying out .NET Core
SDK is installed and configured. Let’s do a simple app just to verify .NET Core works. .NET CLI has built-in templating options to help you start easily developing .NET applications. You can create new application with dotnet new command.
Creating simple example
Create new folder (mkdir myApp) and cd into (cd myApp in my case).
dotnet new console
List contents of the folder (command ls). You’ll see Program.cs file. Cat Program.cs to see the content. Code is just outputing Hello World to the standard output.
Run app with dotnet run and you should see Hello World! output in the terminal.
Installing .NET Core on Linux is straightforward and easy to start with. If you want to avoid terminal (and just have GUI tools to code), you have many options.
My next step is installing/trying out some IDE’s (integrated development environments) to speed up the dev workflow with more complex projects going forward.
If you encounter any challenges with installation, try the manual approach. It worked for me on another Ubuntu distribution, where there were some packages mismatchs.