I have Visual Studio 2022 installed with and without preview, but it seems they all use .NET SDK 9.0 since I upgraded. This turned out to be a terrible decision as since it keeps using old versions of nuget packages. I tried modifying the installation to remove the SDK or also the runtime. But removing the runtime deletes essential Visual studio features.
.NET SDK 8 is not listed in the individual components. Even though I have it installed outside of VS, apparently that's not good enough.
Having uninstalled .NET SDK 9 with VS, it's no longer listed as an installed program in Windows.
Try this:
Check that 8.0.xxx version is installed on your pc (add or remove programs, filter by sdk):
if it's not installed, install one from https://dotnet.microsoft.com/en-us/download/visual-studio-sdks
after that go to solution folder and create a global.json file with contents like (version should be of SDK you installed):
{
"sdk": {
"version": "8.0.313"
}
}
more on global.json https://learn.microsoft.com/en-us/dotnet/core/tools/global-json