Setting up and Running .NET on Linux: A Comprehensive Guide

Kaushal Pareek
Geek Culture
Published in
2 min readJan 18, 2023
Photo by Gabriel Heinzer on Unsplash

The .NET framework is a popular development platform that enables developers to build a wide range of applications for Windows and other platforms. While the framework is primarily associated with Windows, it is also possible to run .NET applications on Linux using the .NET runtime and SDK. In this article, we will provide a step-by-step guide on how to set up and run .NET on a Linux system. Whether you’re a developer looking to build cross-platform applications or simply want to run your existing .NET code on a Linux machine, this guide will help you get started.

  1. First, check if your Linux distribution already has the .NET runtime installed by running the command “dotnet — version” in the terminal.
  2. If the runtime is not already installed, you can download the latest version of the .NET SDK for Linux from the Microsoft website.
  3. Once the download is complete, open a terminal and navigate to the directory where the SDK was downloaded.
  4. Run the command “sudo apt-get install -y dotnet-sdk-3.1” to install the .NET SDK on your Linux system.
  5. After the installation is complete, you can create a new .NET project by running the command “dotnet new console -n myApp” in the terminal.
  6. To run the application, navigate to the project directory and run the command “dotnet run” in the terminal.
  7. To build the application, navigate to the project directory and run the command “dotnet build” in the terminal.
  8. To test the application, navigate to the project directory and run the command “dotnet test” in the terminal.

Please note that the above instructions are for Ubuntu Linux and the process may vary slightly for other Linux distributions. It’s also important to keep your .NET runtime and SDK up-to-date to ensure compatibility with the latest version of the framework.

--

--

Kaushal Pareek
Geek Culture

I have lot’s of interests and technology is one which aces that list.