Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • C# Data Types
  • C# Decision Making
  • C# Methods
  • C# Delegates
  • C# Constructors
  • C# Arrays
  • C# ArrayList
  • C# String
  • C# Tuple
  • C# Indexers
  • C# Interface
  • C# Multithreading
  • C# Exception
Open In App
Next Article:
How to Install Java on Windows, Linux and macOS?
Next article icon

Install and Set Up .NET SDK on Windows, macOS, and Linux

Last Updated : 06 Mar, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

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.

VersionNineDotNetSDK

Step 2: Go to Downloads and install the dotnet-sdk.exe file as shown in the below image.

Downloads

Step 3: Click on the Install button and wait until the installation process is completed.

SDKIntallation

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.

dotnetVersion

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.

DotNETProjectCreation

This is the complete folder structure which is created using the above command.

FolderStructure

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

ProgramDotCSFILE

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

dotNETBuildCMD

Step 7: Now to see the output run the command mentioned below.

dotnet run

DotnetRunCMD

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.



Next Article
How to Install Java on Windows, Linux and macOS?

M

Mithun Kumar
Improve
Article Tags :
  • C#
  • Installation Guide
  • CSharp-Basics

Similar Reads

  • How to Install Java on Windows, Linux and macOS?
    Java is a versatile programming language widely used for building applications. To start coding in Java, you first need to install the Java Development Kit (JDK) on your system. This article provides detailed steps for installing Java on Windows 7, 8, 10, 11, Linux Ubuntu, and macOS. Download and In
    5 min read
  • How to Install Apache Maven on Windows, macOS, and Linux?
    Apache Maven is a comprehensive build automation tool widely used for managing and building Java projects. It simplifies the process of managing project dependencies and building projects through a standardized approach. This article provides step-by-step instructions to install Apache Maven on Wind
    4 min read
  • How to Install Ruby on Rails on Windows and Linux?
    Ruby on Rails or just known as rails, is free and open-source software written in Ruby language under the MIT license. It is a server-side web application development framework, designed to make programming web applications easier by making assumptions about what every developer needs to get started
    2 min read
  • How to Install and Use NVM on Windows
    NVM or Node Version Manager is a command-line tool that allows developers to manage multiple versions of Node.js on a single machine. This function offers the flexibility to work on different projects and versions of Node.js. In this guide, we'll walk you through the steps to install and use NVM on
    3 min read
  • How to Download and Install Postman on Windows?
    Postman is a platform for building and using APIs and helps for simplifying the steps in the APIs lifecycles to streamline collaboration for creating faster APIs. It includes various API tools to accelerate the development cycle, including the design mockups and testing documentation, etc. Postman w
    2 min read
  • How to Install Git on Windows Command Line?
    Git is an open-source and free, decentralized version control system designed to handle projects of all sizes with speed and efficiency. Basically, it is a software tracking application that is commonly used to monitor projects across several teams. The best way of downloading and installing Git on
    3 min read
  • How to Install Yarn in MacOs/Ubuntu/Windows?
    Prerequisite: Difference between npm and yarn Yarn in layman’s term is a package manager that can be used in your code or a project that is currently being built, what yarn does is it helps to share the code with fellow mates or within a community of developers, and they can even run the project tha
    3 min read
  • How to Download and Install Nitro Reader on Windows?
    A PDF editor, a browser-based program for electronic signatures, and PDF productivity tools are available as products. Tools for cloud-based user management, deployment, and analytics are included in subscription services. Additional free document conversion websites are run by Nitro. While customer
    1 min read
  • How to Install OSSEC Agent on Windows?
    OSSEC is an open-source Host dependent Intrusion detection software. OSSEC could be understood as Operating System Security. OSSEC is available for all major operating systems such as Linux, Windows, OS X, Solaris, and many other UNIX-based systems. OSSEC performs various operations to ensure securi
    3 min read
  • How To Install Microsoft Edge On Linux?
    Want to set up Microsoft Edge on a Linux system? Linux users may now access Microsoft Edge, which was previously only available on Windows. Microsoft Edge for Linux is simple to download and use as your daily browser, regardless of the distribution you're using—Ubuntu, Debian, or another. Regardless
    4 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences