不是解决方案,而是我的解决方法:
我让 OmniSharp 处理 Visual 代码,.NET CORE 3.0.100-preview3-010431
但问题似乎来自OmniSharp.MSBuild.Discovery.MSBuildLocator
.
在 Visual Code 中,查看您的 OmniSharp 日志:
不确定您是否会喜欢该解决方案,但在 OmniShart 日志中,我读到它正在使用 Visual Studio 2017 MSBuild,并且当我在 VS 2017 中遇到 .net Core Preview 3 项目的问题时,我安装了 Visual Studio Community 2019 钢筋混凝土。我的代码 .NET CORE 3.0 适用于 VS 2019,但我在 Visual Code 中遇到了 OmniSharp 问题。为了让它在可视代码中工作,我只需将其重命名C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MsBuild
为C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild.disabled
,并且在带有 .NET Core 的可视代码上一切正常。
Located 3 MSBuild instance(s)
1: Visual Studio Enterprise 2017 15.9.28307.344 - "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin"
2: Visual Studio Community 2019 16.0.28714.193 - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin"
3: StandAlone 15.0 - "c:\Users\JPB\.vscode\extensions\ms-vscode.csharp-1.17.1\.omnisharp\1.32.8\msbuild\15.0\Bin"
Registered MSBuild instance: Visual Studio Enterprise 2017 15.9.28307.344 - "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin"
变成:
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Located 2 MSBuild instance(s)
1: Visual Studio Community 2019 16.0.28714.193 - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin"
2: StandAlone 15.0 - "c:\Users\JPB\.vscode\extensions\ms-vscode.csharp-1.17.1\.omnisharp\1.32.8\msbuild\15.0\Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: Visual Studio Community 2019 16.0.28714.193 - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin"
结论: Omnisharp 似乎需要一个支持 .net Core 3.0 的 MSBuild。除了 VS 2019,我在其他任何地方都找不到它。