Published: Tuesday 14 November 2023
The long awaited release of .NET 8 and C# 12 has finally happened!
We'll demonstrate how to update Visual Studio, download the .NET 8 SDK and how to start using .NET 8 in a project.
As a bonus, we'll also show how to get a list of all the SDK's installed.
In-order to use .NET 8, Visual Studio 2022 needs to be updated to version 17.8.0 or above.
To do that, go to Help in the top-left hand corner of the screen and go to Check for Updates.
If there is an update available, it will be shown on the screen.
Update Visual Studio 2022 to 17.8.0
Updating Visual Studio should automatically install the .NET 8 SDK.
However, users that don't use Visual Studio will need to download the .NET 8 SDK from Microsoft's website.
Download the .NET 8 SDK
To check whether the SDK is installed, this command line can be run:
dotnet --list-sdks
This will output all the SDK's installed on the machine. If version 8.0.100 or above appears, .NET 8 is installed.
To create a new .NET 8 project in Visual Studio, go to File, New and Project in the top-left hand corner of the screen.
Select which project to create then go through the steps until the Framework choice appears.
.NET 8 should be selected by default as the framework.
Create a .NET 8 project in Visual Studio
To use .NET 8 in a current project, edit the .csproj
file and ensure that the TargetFramework
in the PropertyGroup
tag is set to net8.0
.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
...
</PropertyGroup>
...
</Project>
.NET 8 and C# 12 has many new and exciting features that includes:
Watch our video where we demonstrate how to update Visual Studio and how to download the .NET 8 SDK.
As a bonus, we'll also cover how Keyed Services work in .NET 8.