Install and Set Up .NET SDK on Windows, macOS, and Linux
Last Updated :
11 Jul, 2025
C# is a powerful programming language used in various applications from desktop to mobile development. It is widely used for building full-stack web applications, AI (Artificial Intelligence), Augmented Reality (AR), and Virtual Reality (VR). In this article, we will set up an environment for C# by installing the .NET SDK.
The official recommendation is to use Visual Studio (IDE) for C# development, as it provides comprehensive features. If we install Visual Studio, the .NET SDK is included and does not need to be downloaded separately.
Download and Install and .NET SDK – Windows Operating System
Step 1: Go to the official website and choose the latest .NET SDK version. Here, we are downloading .NET SDK version 9.
Step 2: Go to Downloads and install the dotnet-sdk.exe file as shown in the below image.
Step 3: Click on the Install button and wait until the installation process is completed.
Step 4: After installation, open command prompt and type the below command to verify the .NET SDK version that is installed in the system.
dotnet --version
If installed correctly, it will display the installed .NET SDK version.
Note: The path is automatically set when we install .NET SDK
Step 5: Now open a command prompt and create an empty .NET project using the following command:
dotnet new console -o <Project-Name>
In the <Project-Name> we can provide the name of the project which we want to build in this example as shown below. Here, we use the project name as HelloWorld. This command will create an empty project template with all the necessary packages required to run the .NET project.
This is the complete folder structure which is created using the above command.
The Program.cs is the entry point in this file the C# code is written we can not directly open this file but we can open it in any IDE like Visual Studio or Visual Studio Code this is the default code which is written inside the program.cs file as shown in the below image
This is a simple program we can run it using the following command mentioned in the below steps.
Step 6: Now we need to build the project using the command mentioned below.
Navigate to the project directory:
cd HelloWorld
Build the project using:
dotnet build
Step 7: Now to see the output run the command mentioned below.
dotnet run
This will execute the default Program.cs file and display output in the console.
Note: Navigate to the newly created project directory using cd <Project-Name> before running dotnet build or dotnet run.
Download and Install .NET SDK - macOS
Step 1: Go to the official website. The website will automatically detect the operating system and then click on Download for macOS.
Step 2: Then go to Downloads and find the dotnet.pkg file and double-click to install it. Then follow the installation instructions.
Step 3: Verify that it is installed correcting by checking the version using the below command on the terminal:
dotnet --version
If it is correctly installed then it shows the version which we download.
Alternative Installation via Homebrew
You can also install .NET SDK using Homebrew:
brew install dotnet-sdk
If necessary, add the .NET CLI tools to your system PATH:
echo 'export PATH="/usr/local/share/dotnet:$PATH"' >> ~/.zshrc
source ~/.zshrc
Download and Install .NET SDK - Linux (Ubuntu)
Step 1: Go to the official website and choose the distribution which we are using. Also, check the compatible version.
Here, we are downloading and installing .NET SDK for ubuntu.
Before installing, update package lists and add Microsoft’s repository:
wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get update
Step 2: Now install the .NET SDK using the below command:
sudo apt-get install -y dotnet-sdk-9.0
Step 3: If you plan to run web applications, install the ASP.NET Core Runtime. This step is optional.
sudo apt-get install -y aspnetcore-runtime-9.0
Step 4: Now verify the installation by using the commanding the terminal which checks the version of the current .NET SDK on the system.
dotnet --version
If the installation is completed successfully then it shows the current version of dotnet.
Similar Reads
How to Install Visual Studio Code in Red Hat Linux In this post, we will see How to Install Visual Studio Code in Red Hat Linux. Visual Studio Code (VSCode) is an important, open-source law editor that has gained immense fashionability among inventors for its inflexibility, expansive extension library, and integrated development terrain( IDE) featur
5 min read
How to install Visual Studio Code on Arch-based Linux Distributions(Manjaro) ? Visual Studio Code is free, powerful and one of the most popular IDE in the market. It is a cross-platform application and can be customized heavily by installing various extensions. All the modern programming languages like C, C++, Java, Python, JavaScript, React, Node JS, etc., are all supported b
2 min read
How to Run Linux Software on Windows Although Windows users could also wish to run Linux software, Linux users frequently desire to run Windows applications on Linux. You can use Linux applications without leaving Windows, whether you're searching for an improved development environment or strong command-line tools. There are several a
5 min read
How to Install Wine in Ubuntu If you've ever wished you had the ability to use Windows programs on Ubuntu, you're not the only one. Most users convert to Linux due to the speed, security, and open-source compatibilityâbut still require the ability to use some Windows-specific software. Thatâs where Wine comes in.Wine (short for
4 min read
How to Install Arduino IDE on Ubuntu In this article, we will be installing Arduino IDE on the Ubuntu system. We will install the application using various different approaches. Arduino IDE is an effective and user-friendly software environment that enables programmers to create and upload code to microcontroller boards that are compat
4 min read
C# .NET Framework (Basic Architecture and Component Stack) C# (C-Sharp) is a modern, object-oriented programming language developed by Microsoft in 2000. It is a part of the .NET ecosystem and is widely used for building desktop, web, mobile, cloud, and enterprise applications. This is originally tied to the .NET Framework, C# has evolved to be the primary
6 min read