Although I have and continue to spend the majority of my time developing .NET5 ASP.NET Core web applications and web API's on macOS, I've noticed that I very much enjoy developing applications on Ubuntu.
Originally I installed Ubuntu on my MacBook Pro, because the majority of the computer science students I tutor also use Ubuntu. Being a huge fan of the JetBrains developer tools, I was excited that IntelliJ IDEA, CLion, and PyCharm ran just as well on Ubuntu as they do on macOS. And, of course, Visual Studio Code works wonderfully on Ubuntu, too. As most of my tutoring involves applications and code samples developed in C, C++, Java, and Python, this works out perfectly.
Wanting to spend even more time on Ubuntu, I have created Ubuntu virtual machines dedicated specifically for Microsoft development. I install .NET5, Visual Studio Code, and JetBrains Rider on Ubuntu for my C# development needs.
I thought installing .NET5 on Ubuntu may be challenging, but it's very simple. So simple, that I've convinced a number of my computer science students to install the .NET5 SDK to learn more about C# and .NET5 development. Although I am clearly biased, I believe that if you know Java and like it, you will easily be able to learn C# and probably like it more :) C# is the new kid on the block, and as such, Microsoft was able to learn from the successes and mistakes of all the other computer languages when creating C#. Now that we can run .NET5 and C# on macOS, Linux, and Windows, I believe it will get even more traction in the future.
The process of installing the .NET5 SDK for development on Ubuntu 20.04 takes 2 steps. First we install the package repository and then we install the .NET5 SDK.
Open a shell in Ubuntu and install the Microsoft package repository using the following commands.
$ wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb $ sudo dpkg -i packages-microsoft-prod.deb
Next, install the latest .NET5 SDK.
sudo apt-get update; \ sudo apt-get install -y apt-transport-https && \ sudo apt-get update && \ sudo apt-get install -y dotnet-sdk-5.0
That's it! You can verify .NET5 is installed using the .NET CLI. The version returned will vary as new versions of .NET5 are released.
$ dotnet --version 5.0.202
You can check the list of .NET SDKs and runtimes you have running on Ubuntu using the .NET CLI as well.
$ dotnet --list-sdks 5.0.202 [/usr/share/dotnet/sdk]
$ dotnet --list-runtimes Microsoft.AspNetCore.App 5.0.5 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 5.0.5 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
At this point you can develop .NET5 applications using your editor or IDE of choice. Visual Studio Code is available on Ubuntu and used by millions of developers to develop all kinds of applications using numerous programming languages. Since Visual Studio Code is developed by Microsoft, you can, of course, use it to develop .NET5 C# applications as well! As mentioned above, I am also personally fond of JetBrains Rider, which can be used to develop .NET5 applications on macOS, Linux, and Windows, too.