c# - VSCode Unity OmniSharp .NETFramework 未找到
问题描述
我在 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 功能。
解决方案
关闭 VS 代码。
下载并安装 Microsoft .NET Framework 4.7.1。
在 VS Code 中,打开
Assembly_CSharp.csproj
文件并更改TargetFrameworkVersion
为您安装的 .NET Framework SDK版本。
您应该为特定版本安装 .NET 框架和目标 sdk。
这是一个临时解决方案,因为targetFrameworkVersion
关闭编辑器时总是更改为统一默认值
推荐阅读
- docker - 在 Travis CI for Cypress 中构建镜像的 Docker-compose 缓存
- git - Visual Studio 未知错误的扩展 - 无法推送或获取任何内容
- html - 替代用于在自定义形状周围显示阴影的阴影过滤器
- php - 使用 Office 365 Codeigniter 发送邮件
- php - 使用 PHP 将 JSON 数据保存到 MySQL
- c# - BLE 不会在 Xamarin 中扫描
- opencart - 来自 Opencart 树枝的信息 ID
- webpack - Nativescript Webpack 安装错误
- css - R/Shiny:框的颜色取决于选择
- c# - 在 asp.net mvc 中屏蔽 const 字符串