Error: The reference assemblies for .NETFramework,Version=v5.0 were not found

Error: The reference assemblies for .NETFramework,Version=v5.0 were not found

我在学习 .net 5 和 c# 9 时安装了 VS code 来构建简单示例。但是 VS code 无法识别 .net sdk 5。我可以创建新的控制台项目作为 net 5。

但是我不使用这些属性; 在问题部分查看问题 右键单击 > 查看定义

我在网上搜索了解决方案,并在下面做了一些事情; 设置“omnisharp: select project > my current project” 重新安装.Net SDK 5, 改变全向路径, 将“使用全局单声道”属性 更改为“始终”

我在下面留下了输出屏幕,你更了解:

[fail]: OmniSharp.MSBuild.ProjectLoader The reference assemblies for .NETFramework,Version=v5.0 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks

[warn]: OmniSharp.MSBuild.ProjectManager Failed to load project file 'c:\Users\ilyas\Desktop.Net Notes.Net 5 and C# 9\Basics\Basics.csproj'. c:\Users\ilyas\Desktop.Net Notes.Net 5 and C# 9\Basics\Basics.csproj C:\Program Files (x86)\Microsoft Visual Studio19\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(1177,5): Error: The reference assemblies for .NETFramework,Version=v5.0 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks

[fail]: OmniSharp.MSBuild.ProjectManager Attempted to update project that is not loaded: c:\Users\ilyas\Desktop.Net Notes.Net 5 and C# 9\Basics\Basics.csproj

P.S。我是英语新手,语法规则请见谅

我终于明白为什么会出现这个错误了。我已经安装了目标框架,但是“vs code”试图获取“VS 2019 社区内的 .net 5 sdk”。我已经升级了 VS 2019 社区,这解决了我的问题。