Install .NET for C# Development

Your comprehensive guide to getting started with .NET and C#

Getting Started: Installing .NET

Welcome to the world of C# programming with .NET! This guide will walk you through the essential steps to install the .NET SDK (Software Development Kit), which includes everything you need to build, run, and deploy .NET applications.

Note: While this guide focuses on installation, ensure you also have a code editor or Integrated Development Environment (IDE) like Visual Studio or VS Code. Visual Studio includes the .NET SDK by default.

Why Install the .NET SDK?

.NET SDK is a free, cross-platform, open-source framework for building many different types of applications. It includes:

Supported Versions

Microsoft offers Long Term Support (LTS) and Standard Term Support (STS) releases. LTS releases are recommended for production environments due to their longer support lifecycle.

For new projects, we recommend installing the latest LTS version, .NET 8.

Installation Instructions by Operating System

Windows

The easiest way to install .NET on Windows is by using the official installer.

  1. Visit the official .NET download page: https://dotnet.microsoft.com/en-us/download
  2. Select the latest LTS version (e.g., .NET 8).
  3. Download the Windows x64 Installer (or x86 if you have a 32-bit system).
  4. Run the downloaded installer and follow the on-screen prompts. The installer will automatically add .NET to your system's PATH.

Using the .NET CLI (Optional):

You can also install using the Windows Package Manager (winget):

winget install --id Microsoft.DotNet.SDK.8
Download for Windows

macOS

You can install .NET on macOS using Homebrew or by downloading the installer.

Using Homebrew (Recommended):

  1. If you don't have Homebrew, install it from https://brew.sh/.
  2. Open your Terminal and run:
brew install --cask dotnet-sdk

This will install the latest SDK version.

Using the Installer:

  1. Visit the official .NET download page: https://dotnet.microsoft.com/en-us/download
  2. Select the latest LTS version (e.g., .NET 8).
  3. Download the macOS x64 (or ARM64 for Apple Silicon) Installer.
  4. Run the downloaded package and follow the instructions.
Download for macOS

Linux

Installation on Linux varies slightly by distribution. The most common method is using a package manager or the script provided by Microsoft.

Using the Microsoft Package Repository (Recommended for Debian/Ubuntu):

  1. Open your terminal and run the following commands to register the Microsoft package repository. Replace 8.0 with the desired major version if needed.
wget https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \
&& sudo dpkg -i packages-microsoft-prod.deb \
&& rm packages-microsoft-prod.deb
sudo apt-get update
sudo apt-get install -y dotnet-sdk-8.0

Using the Install Script (Universal):

This method works on most Linux distributions.

wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh
chmod +x ./dotnet-install.sh
./dotnet-install.sh --version 8.0 --install-dir $HOME/.dotnet

Follow the script's output for adding .NET to your PATH.

Refer to the official .NET documentation for specific instructions for your Linux distribution.

Download for Linux

Verifying Your Installation

Once the installation is complete, you can verify it by opening your terminal or command prompt and running the following command:

dotnet --version

This command should output the version of the .NET SDK you just installed (e.g., 8.0.100).

Congratulations! You have successfully installed the .NET SDK and are ready to start building your C# applications.

Next Steps

Now that .NET is installed, you might want to: