c# - 找不到 VSCode Unity OmniSharp .NETFramework

标签 c# .net visual-studio-code

我在 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 功能。

最佳答案

您应该为特定版本同时安装 .NET 框架和目标 sdk。

这是一个临时解决方案,因为 targetFrameworkVersion 总是在您关闭编辑器时更改为统一默认值

关于c# - 找不到 VSCode Unity OmniSharp .NETFramework,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56118898/

相关文章:

c# - Sitecore Fast Query - 如何搜索包含特殊字符(例如撇号)的文本?

c# - 无法在 Visual Studio Code 上启动 C# 调试器

C++ VSCode CMake VCPKG : manifests are not enabled

c# - 在使用 SQL 查询的单元测试中模拟 IDocumentQuery

c# - Linq Select 为什么我会得到结果?

c# - Hierarchyid 数据类型和 Code First

.net - Visual Studio 文档 XML 注释标签中神秘的 "usage"标签

c# - 有没有办法压缩内存中的对象并透明地使用它?

c++ - DataContractSerialize 错误

visual-studio-code - VSCode 中的动态语法突出显示