For me the solution was to go to the Visual Studio Installer, select Modify for Visual Studio 2022, go to Individual Components, select and install the .NET SDK.
Modify
Individual Components
.NET SDK