我在VSCode的输出中得到了此消息
[fail]: OmniSharp.MSBuild.ProjectLoader
The reference assemblies for framework ".NETFramework,Version=v4.7.1" were not found.
To resolve this, install the SDK or Targeting Pack for this framework version
or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the
Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend.
这是我的dotnet
输出的样子
~ dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 2.2.106
Commit: aa79b139a8
Runtime Environment:
OS Name: Mac OS X
OS Version: 10.14
OS Platform: Darwin
RID: osx.10.14-x64
Base Path: /usr/local/share/dotnet/sdk/2.2.106/
Host (useful for support):
Version: 2.2.4
Commit: f95848e524
.NET Core SDKs installed:
2.2.106 [/usr/local/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.2.4 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.2.4 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.2.4 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
由于这个错误,我无法在VSCode中获得C#的任何IDE功能。
答案 0 :(得分:1)
如果有人遇到类似问题,则安装最新的稳定Mono版本应该可以解决此问题。 mono-project.com/download/stable。或者尝试其他解决方法,直到解决为止,可能是某些单声道版本阻止了此操作。
答案 1 :(得分:0)
关闭VS代码。
下载并安装Microsoft .NET Framework 4.7.1。
下载并安装Microsoft's .NET Framework SDK any version with start 4.X
在VS Code中,打开Assembly_CSharp.csproj
文件,并将TargetFrameworkVersion
更改为您安装的.NET Framework SDK 版本。
您应该同时安装.NET框架和针对特定版本的目标SDK。
这是一个临时解决方案,因为targetFrameworkVersion
在关闭编辑器时始终更改为统一默认值