Omnisharp-vscode: Did not find 'Microsoft.NETCore.App' in lock file.

Created on 3 Oct 2019  路  10Comments  路  Source: OmniSharp/omnisharp-vscode

Issue Description

After installing the latest version of Omnisharp (1.34.4) I'm still experiencing issues running VSCode similar to those described in https://github.com/OmniSharp/omnisharp-vscode/issues/3290.

I don't have much experience diagnosing Omnisharp issues but my guess is that it's something to do with the missing reference to Microsoft.NETCore.App. I can see from the log that I have 2 MSBuild instances installed and it appears to be using the Mono 6.4 one rather than the Standalone.

Steps to Reproduce

  • dotnet new console
  • dotnet build/run - works as expected
  • Open VSCode

Expected Behavior

C# extension features to work as expected.

Actual Behavior

Lots of "errors", due to missing references:

image

Logs

OmniSharp log

Starting OmniSharp server at 03/10/2019, 21:56:18
    Target: /Users/ben.foster/source/checkout-bootstrap-dotnet/SqsConsumer

OmniSharp server started with Mono 6.4.0.
    Path: /Users/ben.foster/.vscode/extensions/ms-vscode.csharp-1.21.4/.omnisharp/1.34.4/omnisharp/OmniSharp.exe
    PID: 51738

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on MacOS 10.13.4 (x64)
[info]: OmniSharp.Services.DotNetCliService
        DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 2 MSBuild instance(s)
            1: Mono 16.0 - "/usr/local/Cellar/mono/6.4.0.198/lib/mono/msbuild/Current/bin"
            2: StandAlone 16.0 - "/Users/ben.foster/.vscode/extensions/ms-vscode.csharp-1.21.4/.omnisharp/1.34.4/omnisharp/.msbuild/Current/Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: Mono 16.0 - "/usr/local/Cellar/mono/6.4.0.198/lib/mono/msbuild/Current/bin"
            CscToolExe = csc.exe
            CscToolPath = /Users/ben.foster/.vscode/extensions/ms-vscode.csharp-1.21.4/.omnisharp/1.34.4/omnisharp/.msbuild/Current/Bin/Roslyn
[info]: OmniSharp.Cake.CakeProjectSystem
        Detecting Cake files in '/Users/ben.foster/source/checkout-bootstrap-dotnet/SqsConsumer'.
[info]: OmniSharp.Cake.CakeProjectSystem
        Could not find any Cake files
[info]: OmniSharp.MSBuild.ProjectSystem
        No solution files found in '/Users/ben.foster/source/checkout-bootstrap-dotnet/SqsConsumer'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for '/Users/ben.foster/source/checkout-bootstrap-dotnet/SqsConsumer/SqsConsumer.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in '/Users/ben.foster/source/checkout-bootstrap-dotnet/SqsConsumer'.
[info]: OmniSharp.Script.ScriptProjectSystem
        Could not find any CSX files
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: /Users/ben.foster/source/checkout-bootstrap-dotnet/SqsConsumer/SqsConsumer.csproj
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider, Order: 100
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.EditorConfigWorkspaceOptionsProvider, Order: 200
[info]: OmniSharp.WorkspaceInitializer
        Configuration finished.
[info]: OmniSharp.Stdio.Host
        Omnisharp server running using Stdio at location '/Users/ben.foster/source/checkout-bootstrap-dotnet/SqsConsumer' on host 51191.
[info]: OmniSharp.MSBuild.ProjectManager
        Successfully loaded project file '/Users/ben.foster/source/checkout-bootstrap-dotnet/SqsConsumer/SqsConsumer.csproj'.
[info]: OmniSharp.MSBuild.ProjectManager
        Adding project '/Users/ben.foster/source/checkout-bootstrap-dotnet/SqsConsumer/SqsConsumer.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Update project: SqsConsumer
[warn]: OmniSharp.MSBuild.PackageDependencyChecker
        SqsConsumer: Did not find 'Microsoft.NETCore.App' in lock file.

C# log

Post the output from Output-->C# here

Environment information

VSCode version: 1.38.1
C# Extension: 1.21.4

Mono Information
OmniSharp using global mono :6.4.0

Dotnet Information
.NET Core SDK (reflecting any global.json):
Version: 3.0.100
Commit: 04339c3a26

Runtime Environment:
OS Name: Mac OS X
OS Version: 10.13
OS Platform: Darwin
RID: osx.10.13-x64
Base Path: /usr/local/share/dotnet/sdk/3.0.100/

Host (useful for support):
Version: 3.0.0
Commit: 7d57652f33

.NET Core SDKs installed:
2.1.302 [/usr/local/share/dotnet/sdk]
2.1.500 [/usr/local/share/dotnet/sdk]
2.2.104 [/usr/local/share/dotnet/sdk]
3.0.100 [/usr/local/share/dotnet/sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.6 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download


Visual Studio Code Extensions

|Extension|Author|Version|
|---|---|---|
|bower|donjayamanne|0.0.3|
|cake-vscode|cake-build|0.12.0|
|csharp|ms-vscode|1.21.4|
|csharpextensions|jchannon|1.3.0|
|css-compressor|bestvow|0.0.2|
|docomment|k--kato|0.1.8|
|dotnet-test-explorer|formulahendry|0.7.1|
|EditorConfig|EditorConfig|0.13.0|
|gitlens|eamodio|10.0.1|
|Lua|keyring|0.0.9|
|markdown-pdf|yzane|1.3.1|
|mssql|ms-mssql|1.6.0|
|openapi-lint|mermade|1.0.4|
|plantuml|jebbs|2.12.1|
|vscode-css-formatter|aeschli|1.0.1|
|vscode-docker|ms-azuretools|0.8.1|
|vscode-mocha-test-adapter|hbenl|2.1.2|
|vscode-mysql|formulahendry|0.4.0|
|vscode-nuget-package-manager|jmrog|1.1.6|
|vscode-proto3|zxh404|0.3.0|
|vscode-pull-request-github|GitHub|0.11.2|
|vscode-test-explorer|hbenl|2.14.6|
|vscode-yaml|redhat|0.5.3|
|vsliveshare|ms-vsliveshare|1.0.905|;

Most helpful comment

Mono here https://www.mono-project.com/download/stable/ comes with everything correctly configured, you may want to prefer it over the homebrew distro.

All 10 comments

looks like you have a global mono without msbuild with an older msbuild (not 16.3)
Either install global Mono with msbuild 16.3 or try setting "omnisharp.useGlobalMono": "never"

Mono here https://www.mono-project.com/download/stable/ comes with everything correctly configured, you may want to prefer it over the homebrew distro.

I uninstalled mono from homebrew and installed this one from the Mono site as instructed. I can confirm VSCode/Omnisharp is now working as expected.

Thanks for your help.

great, thanks!
I will have a look at what we can do to improve detecting such "incomplete" or invalid Mono versions to minimize these situations 馃憤

Updated to the latest mono framework, and it resolved the issue

looks like you have a global mono ~without msbuild~ with an older msbuild (not 16.3)
Either install global Mono with msbuild 16.3 or try setting "omnisharp.useGlobalMono": "never"

Thanks, man. That's work for me.

I'm seeing the same error but without mono installed on Windows 10. Could it be still something with how MSBuildLocator is resolving still? Below is the relevant section of the OmniSharp Log output.

[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 4 MSBuild instance(s)
            1: Visual Studio Community 2019 16.1.29025.244 - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin"
            2: Visual Studio Community 2017 15.7.27703.1 - "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin"
            3: Visual Studio Build Tools 2017 15.9.28307.481 - "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin"
            4: StandAlone 16.3 - "c:\Users\kainh\.vscode\extensions\ms-vscode.csharp-1.21.6\.omnisharp\1.34.6\.msbuild\Current\Bin"

I'm expecting it to resolve to the latest dotnet core 3.0 SDK so I'm not sure why OmniSharp would care about these old visual studio instances I have laying around on my system if this is the problem.

@jpierson you have the same issue as described here https://github.com/OmniSharp/omnisharp-vscode/issues/3390#issuecomment-549158294

in short: you need to update or remove VS2019

Mono here mono-project.com/download/stable comes with everything correctly configured, you may want to prefer it over the homebrew distro.

Is there a way to report this to the homebrew mono maintainers since it _could_ be fixed.

I had the exact same problem. I've tried to reinstall Mono via brew with no luck - installed from the Mono website => it worked!
Thank you very much!

Was this page helpful?
0 / 5 - 0 ratings