Add a reference to ".NETFramework,Version=x" in the "TargetFrameworks" property of your project file and then re-run NuGet restore?
Sometimes when upgrading .NET framework versions you might get this really strange error in Visual Studio: -"Add a reference to ".NETFramework,Version=v4.8" in the "TargetFrameworks" property of your project file and then re-run NuGet restore?"…