.NET 7 apps are now vulnerable and must be updated now!
Published: Monday 27 May 2024
If you have an application running with .NET 7, you must update it now!
End of life
.NET 7 was set to End of Life (or EOL) on 14th May 2024. What this means is that Microsoft no longer provides fixes, updates, or online technical assistance for any versions with this status.
Why is an earlier version of .NET still supported?
Microsoft release a new major version of .NET every November, and each version alternates between Standard Term Support (or STS) and Long Term Support (or LTS).
| Version | Release date | End of support |
|---|---|---|
| .NET 6 (LTS) | 8th November 2021 | 12th November 2024 |
| .NET 7 (STS) | 8th November 2022 | 14th May 2024 |
| .NET 8 (LTS) | 14th November 2023 | 10th November 2026 |
Why should you update?
Microsoft state in their .NET Core support policy that "out-of-support .NET versions may put your applications, application data, and computing environment at risk."
How do you update?
First of all, you need to download the SDK of the .NET version you are going to use.
If you're using Visual Studio
When updating Visual Studio, it should download the latest .NET SDK.
Update Visual Studio 2022 to 17.9.7
Once you've updated, you can see what versions of the .NET SDK are installed on your machine.
dotnet --list-sdks
Lists the versions of the .NET SDK installed
If the version you wish to update has been installed, you are good to go.
If you're using Visual Studio Code
If the version isn't installed, or you are using Visual Studio Code, you'll need to download the .NET SDK from the Microsoft website.
Download one of the supported .NET versions
This will take you through to a page with all the updates for that version. We recommend that you install the latest release for it.
Download the .NET SDK onto your machine depending on your operating system
Go ahead and install it and you should be good to go.
Update projects
Now you will have to update each project in your application to the .NET version that you are using.
.csproj file which is the project file for your application.
<TargetFramework> tag from net7.0 to the version you wish to update it to.
net8.0.
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
...
</Project>
Update Docker
If you're using Docker, you'll need to update the Docker file named Dockerfile.
7.0 to the version that you are updating to:
# ASP.NET Core Runtime (update to .NET 8)
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
# .NET SDK (update to .NET 8)
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
...
Update NuGet packages
You'll also have to update all the Microsoft.AspNetCore NuGet packages to the version that you are using as a minimum.
Upgrade NuGet packages for your solution in Visual Studio
Publish your application as self-contained
If you are publishing your application, you can publish it as self-contained meaning the published files also contains the .NET runtime and libraries as well as your application. This means you don't need to update or install the ASP.NET Core Runtime on your machine.
--self-contained parameter included.
dotnet publish RoundTheCode.DotNetUpgrade.csproj -c Release -o publish --self-contained
The parameters are as follows:
-c= The configuration (Debug or Release)-o= The folder to publish the files to--self-contained= Publishes it as a self-contained application
Installing the ASP.NET Core Runtime
If you wish to install or update the ASP.NET Core Runtime onto your machine, you'll need to download it from the Microsoft website.
Install the .NET runtime depending on which operating system you'll using
Watch the video
Watch our video where we go through these steps so you can follow along and update your application to a .NET version that is in support.
Related articles