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:
- The .NET Runtime: To run applications.
- The .NET CLI: Command-line tools for creating, building, running, and publishing .NET applications.
- The C# Compiler: To translate your C# code into executable programs.
- Target Frameworks: Libraries that your applications can depend on.
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.
- .NET 8 LTS (Latest LTS)
- .NET 6 LTS
- .NET 7 STS (End of support soon)
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.
- Visit the official .NET download page: https://dotnet.microsoft.com/en-us/download
- Select the latest LTS version (e.g., .NET 8).
- Download the Windows x64 Installer (or x86 if you have a 32-bit system).
- 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):
- If you don't have Homebrew, install it from https://brew.sh/.
- Open your Terminal and run:
brew install --cask dotnet-sdk
This will install the latest SDK version.
Using the Installer:
- Visit the official .NET download page: https://dotnet.microsoft.com/en-us/download
- Select the latest LTS version (e.g., .NET 8).
- Download the macOS x64 (or ARM64 for Apple Silicon) Installer.
- Run the downloaded package and follow the instructions.
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):
- 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 LinuxVerifying 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:
- Install Visual Studio or Visual Studio Code.
- Create your first C# application using the .NET CLI.
- Explore the C# programming language basics.