vscode omnisharp intellisense不适用于dotnet 5.0(目标网络5.0)



VsCode Omnisharp不会加载以net5.0为目标的项目。针对较低版本SDK的项目似乎一切都很好。Omnisharp加载项目失败,出现以下错误:

";找不到.NETFramework v5.0版本的引用程序集。若要解决此问题,请为此框架版本安装开发包(SDK/Targeting Pack(或重新确定应用程序的目标。您可以在以下位置下载.NET Framework开发包:https://aka.ms/msbuild/developerpacks">

据我所知;开发者包";5.0,所以我不知道该怎么办。然而,Omnisharp似乎是唯一的问题。该项目将在没有错误的情况下生成和运行。我想这意味着MSBuild正在找到框架。Omnisharp的扩展版本是v1.23.8。

Omnisharp日志的相关部分和错误:

Starting OmniSharp server at 1/10/2021, 5:49:52 PM
Target: c:UsersUser NameDocumentsMyProjectCodetest3
OmniSharp server started.
Path: c:UsersUser Name.vscodeextensionsms-dotnettools.csharp-1.23.8.omnisharp1.37.6-beta.23OmniSharp.exe
PID: 7580
[info]: OmniSharp.Stdio.Host
Starting OmniSharp on Windows 6.2.9200.0 (x64)
[info]: OmniSharp.Services.DotNetCliService
DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Located 2 MSBuild instance(s)
1: Visual Studio Community 2019 16.7.30406.217 - "C:Program Files (x86)Microsoft Visual Studio2019CommunityMSBuildCurrentBin"
2: StandAlone 16.8.0 - "c:UsersUser Name.vscodeextensionsms-dotnettools.csharp-1.23.8.omnisharp1.37.6-beta.23.msbuildCurrentBin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: Visual Studio Community 2019 16.7.30406.217 - "C:Program Files (x86)Microsoft Visual Studio2019CommunityMSBuildCurrentBin"
...
[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:UsersUser NameDocumentsMyProjectCodetest3test.webtest.web.csproj'.

这是我的网络——信息输出:

.NET SDK (reflecting any global.json):
Version:   5.0.100     
Commit:    5044b93829  
Runtime Environment:    
OS Name:     Windows   
OS Version:  10.0.18363
OS Platform: Windows   
RID:         win10-x64
Base Path:   C:Program Filesdotnetsdk5.0.100
Host (useful for support):
Version: 5.0.0
Commit:  cf258a14b7
.NET SDKs installed:
2.2.104 [C:Program Filesdotnetsdk]
2.2.401 [C:Program Filesdotnetsdk]
3.1.201 [C:Program Filesdotnetsdk]
3.1.401 [C:Program Filesdotnetsdk]
5.0.100 [C:Program Filesdotnetsdk]
.NET runtimes installed:
Microsoft.AspNetCore.All 2.2.2 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.5 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.6 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.2.2 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.5 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.6 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.3 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.7 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.App]
Microsoft.NETCore.App 2.2.2 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
Microsoft.NETCore.App 2.2.5 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
Microsoft.NETCore.App 2.2.6 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
Microsoft.NETCore.App 3.0.0 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
Microsoft.NETCore.App 3.1.3 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
Microsoft.NETCore.App 3.1.7 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
Microsoft.NETCore.App 5.0.0 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.3 [C:Program FilesdotnetsharedMicrosoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.7 [C:Program FilesdotnetsharedMicrosoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.0 [C:Program FilesdotnetsharedMicrosoft.WindowsDesktop.App]

您的电脑上安装了Visual Studio,版本为16.7,OmniSharp正在尝试使用其构建工具来启动,但它不是支持.NET 5.0的16.8。只要将VS更新到最新版本,everithinng就会如您所愿。

相关内容

  • 没有找到相关文章

最新更新