c sharp

How to Install C# on Linux

C# is type-safe, modern, scalable, object-oriented, component-oriented, structured, and a simple language. C# is a part of languages with excellent performance and high scope for scalability. It is similar to C++ and Java in various ways.

C# is used to develop the web apps, computer apps, and various types of web services. However, many Linux users or people who recently shifted to a Linux system don’t know how to install C# correctly. So, in this quick guide, we will explain the simple methods to install and use C# on any Linux OS easily.

How to Install C# on Linux

The “.NET” software development kit is crucial for C# development. So, open the terminal and type the following commands. These configure your Linux system to install the packages from Microsoft’s official packages website.

wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb

 

Replace “ubuntu” and “22.04” with your Linux distribution and version.

sudo dpkg -i packages-microsoft-prod.deb

 

Install the Software Development Kit (SDK).

sudo apt update
sudo apt install -y apt-transport-https
sudo apt install dotnet-sdk-8.0 -y

 

Verify your installation using the “dotnet –version”. If correctly installed, this will display the current “.NET SDK” version.


Now, you need VS Code where you can install C#.

sudo snap install --classic code

 

Open the Visual Studio Code from the “Applications” menu and complete the personalization process.

You can also install the basic C#, the second option in search results. However, the Dev Kit is its advanced version consisting of some premade templates, debugging, and many more solutions.


Finally, you installed C# and you can start the C# programming on your Linux system. Moreover, there are two ways to do it: first is by coding inside the Visual Studio Code and second is by creating a console application in the terminal.

Quick Summary

C# is a trendy and versatile programming language that offers many great features. You can use C# to create the apps for multiple platforms including Windows, IOS, Android, Linux, etc. However, many users want to code with their Linux devices, so this short guide explains how to install C# on Linux. Among many other methods that are present on the internet, this one will help you install it effortlessly.

About the author

Prateek Jangid

A passionate Linux user for personal and professional reasons, always exploring what is new in the world of Linux and sharing with my readers.