How to Install .NET 8 SDK: Step-by-Step Guide
If you are starting with C# and .NET development, one of the first things you need to install is the .NET SDK.
The .NET SDK includes everything you need to build and run .NET applications, including the .NET CLI, compiler, runtime, and project templates.
In this guide, you will learn how to install .NET 8 SDK on Windows, Linux, and macOS, how to verify the installation, and how to create your first .NET 8 application.
What Is .NET 8?
.NET 8 is a Long Term Support (LTS) release of Microsoft's .NET platform.
It can be used to build:
ASP.NET Core Web APIs
MVC applications
Blazor applications
Console applications
Worker services
Desktop applications
Cloud applications
Cross-platform applications
If you want to develop applications targeting .NET 8, you should install the .NET 8 SDK.
SDK vs Runtime: What Should You Install?
Before installing .NET, it is important to understand the difference between the SDK and Runtime.
.NET SDK
The SDK is required when you want to develop and build .NET applications.
It includes:
.NET runtime
C# compiler
.NET CLI
Project templates
Build tools
NuGet tooling
.NET Runtime
The runtime is mainly required to run applications that have already been built.
For development, install the .NET SDK rather than only the runtime.
Step 1: Download the .NET 8 SDK
Go to Microsoft's official .NET download page:
Download .NET 8 SDK from Microsoft
Look for the SDK section.
Choose the installer for your operating system.
For a typical Windows development machine, choose the Windows x64 SDK installer.
Tip: Make sure you select the SDK, not just the Runtime.
Step 2: Install .NET 8 on Windows
After downloading the installer, open the .exe file.
The .NET SDK installation wizard will appear.
Click:
Install
Windows may ask for administrator permission.
Allow the installation to continue.
Once the installation is complete, click:
Close
The .NET 8 SDK should now be installed on your computer.
Step 3: Verify the Installation
Open Command Prompt, PowerShell, or Windows Terminal.
Run:
dotnet --version
You should see a .NET 8 SDK version, for example:
8.0.xxx
The exact patch version may be different depending on the latest .NET 8 servicing release installed on your machine.
You can also run:
dotnet --info
This displays additional information about your .NET installation.
For example, you can see:
SDK version
Runtime versions
Operating system
Architecture
Installed SDKs
Installed runtimes
Step 4: Check All Installed .NET SDKs
If you have multiple versions of .NET installed, run:
dotnet --list-sdks
You may see something similar to:
8.0.4xx [C:\Program Files\dotnet\sdk]
10.0.xxx [C:\Program Files\dotnet\sdk]
This means multiple SDK versions are installed.
Having multiple .NET SDK versions installed on the same machine is normal.
You can also check installed runtimes with:
dotnet --list-runtimes
Step 5: Create a .NET 8 Console Application
Now let's verify that the SDK can actually create and build a .NET 8 project.
Create a new console application:
dotnet new console -n HelloDotNet8
Move into the project directory:
cd HelloDotNet8
Open the project file:
HelloDotNet8.csproj
You should see a target framework similar to:
<TargetFramework>net8.0</TargetFramework>
This tells .NET that the project targets .NET 8.
Step 6: Run the Application
Run:
dotnet run
You should see:
Hello, World!
Congratulations! Your .NET 8 development environment is working.
Step 7: Build the Application
You can also build the project using:
dotnet build
If the build succeeds, you should see output indicating that the project was built successfully.
The compiled files will normally be placed under:
bin\Debug\net8.0
Installing .NET 8 on Linux
.NET 8 can also be installed on Linux distributions such as Ubuntu, Debian, Fedora, and others.
Microsoft provides installation instructions for supported Linux distributions.
Install .NET on Linux — Microsoft Learn
For Ubuntu, Microsoft provides package-based installation instructions.
After installation, verify it with:
dotnet --version
Then check the installed SDKs:
dotnet --list-sdks
Installing .NET 8 on macOS
For macOS, download the appropriate .NET SDK installer from Microsoft's official download page.
Choose the appropriate architecture for your Mac.
For example, newer Apple Silicon Macs use the Arm64 architecture, while Intel-based Macs use x64.
After installation, open Terminal and run:
dotnet --version
Then verify the installed SDKs:
dotnet --list-sdks
Do You Need Visual Studio?
No.
You can develop .NET applications using the .NET SDK and the command line alone.
However, IDEs and code editors can make development easier.
Popular options include:
Visual Studio
Visual Studio Code
JetBrains Rider
The important requirement is that the appropriate .NET SDK is installed.
How to Check Whether a Project Uses .NET 8
Open the .csproj file.
Look for:
<TargetFramework>net8.0</TargetFramework>
For example:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
The important part is:
<TargetFramework>net8.0</TargetFramework>
Common Problems When Installing .NET 8
1. dotnet Command Not Found
If you run:
dotnet --version
and receive an error indicating that dotnet is not recognized, the SDK may not be installed correctly or the PATH environment variable may not have been updated.
Try opening a new terminal window first.
If the problem continues, verify that the .NET installation exists and that the installation directory is included in your system PATH.
2. Only the Runtime Is Installed
If you installed only the .NET Runtime, you may not be able to create or build applications.
For development, install the .NET 8 SDK.
Check:
dotnet --list-sdks
If no .NET 8 SDK appears, install the SDK.
3. Multiple SDK Versions Are Installed
You might have .NET 8 and newer .NET SDKs installed at the same time.
For example:
8.0.xxx
10.0.xxx
This is supported.
You can check which SDK is being used in a particular project with:
dotnet --version
You can also use a global.json file when you need to control SDK selection for a project or solution.
.NET 8 Installation Checklist
Before starting development, verify the following:
.NET 8 SDK is installed
dotnet --versionworksdotnet --list-sdksshows .NET 8A .NET 8 project can be created
dotnet buildsucceedsdotnet runworksThe project targets
net8.0
Useful .NET CLI Commands
Here are some commands you will use frequently:
| Command | Purpose |
|---|---|
dotnet --version | Displays the active SDK version |
dotnet --info | Displays detailed .NET information |
dotnet --list-sdks | Lists installed SDKs |
dotnet --list-runtimes | Lists installed runtimes |
dotnet new | Creates a new project |
dotnet restore | Restores NuGet packages |
dotnet build | Builds a project |
dotnet run | Builds and runs a project |
dotnet test | Runs tests |
dotnet publish | Publishes an application |
Conclusion
Installing .NET 8 is straightforward.
For development, install the .NET 8 SDK, rather than only the runtime. After installation, use:
dotnet --version
to verify the SDK.
You can then create your first .NET 8 application with:
dotnet new console -n HelloDotNet8
cd HelloDotNet8
dotnet run
If the application displays:
Hello, World!
your .NET 8 development environment is ready.
Looking for 1:1
Comments
Post a Comment