Omnisharp-vscode: Failed to load project file (under macOS Catalina)

Created on 14 Nov 2019  Â·  10Comments  Â·  Source: OmniSharp/omnisharp-vscode

Issue Description

I have an existing solution with about 7 projects inside. I've had no issues until lately with Omnisharp running so I can click around my functions to navigate between files. However this seems to have changed since macOS Catalina.

OmniSharp log

Post the output from Output-->OmniSharp log here

Failed to load project file '/Users/username/path/to/project/project.csproj'.
/Users/username/path/to/project.csproj(1,1)
Microsoft.Build.Exceptions.InvalidProjectFileException: The imported project "/Library/Frameworks/Mono.framework/Versions/5.2.0/lib/mono/xbuild/Current/Microsoft.Common.props" was not found. Also, tried to find "Current/Microsoft.Common.props" in the fallback search path(s) for $(MSBuildExtensionsPath) - "/Library/Frameworks/Mono.framework/External/xbuild/" . These search paths are defined in "/Users/username/.vscode/extensions/ms-vscode.csharp-1.21.7/.omnisharp/1.34.7/omnisharp/OmniSharp.exe.config". Confirm that the path in the <Import> declaration is correct, and that the file exists on disk in one of the search paths.  /usr/local/share/dotnet/sdk/2.2.402/Sdks/Microsoft.NET.Sdk/Sdk/Sdk.props

C# log

Post the output from Output-->C# here

None

Environment information

macOS version: 10.15.1
VSCode version: 1.40.1
C# Extension: 1.21.7

Mono Information
OmniSharp using built-in mono

Dotnet Information
.NET Core SDK (reflecting any global.json):
Version: 2.2.402
Commit: c7f2f96116

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

Host (useful for support):
Version: 2.2.7
Commit: b1e29ae826

.NET Core SDKs installed:
2.2.100 [/usr/local/share/dotnet/sdk]
2.2.106 [/usr/local/share/dotnet/sdk]
2.2.301 [/usr/local/share/dotnet/sdk]
2.2.402 [/usr/local/share/dotnet/sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.2.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.4 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.7 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.2.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.4 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.7 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.2.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.4 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.6 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.7 [/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|
|---|---|---|
|android-dev-ext|adelphes|0.8.0|
|atom-keybindings|ms-vscode|3.0.6|
|azure-account|ms-vscode|0.8.7|
|bower|donjayamanne|0.0.3|
|csharp|ms-vscode|1.21.7|
|Csharp-ASPNETCore|rahulsahay|1.11.0|
|debugger-for-chrome|msjsdiag|4.12.1|
|electron-debug|kodetech|18.11.1|
|gc-excelviewer|GrapeCity|2.1.32|
|githistory|donjayamanne|0.4.6|
|Go|ms-vscode|0.11.9|
|Gradle|cazzar09|1.1.2|
|html-snippets|abusaidm|0.2.1|
|material-icon-theme|PKief|3.9.1|
|mono-debug|ms-vscode|0.15.8|
|mssql|ms-mssql|1.7.0|
|node-debug2|ms-vscode|1.39.3|
|npm-intellisense|christian-kohler|1.3.0|
|powershell|ms-vscode|2019.11.0|
|prettify-json|mohsen1|0.0.3|
|Theme-MaterialKit|ms-vscode|0.1.4|
|useful-react-snippets|igorming|1.5.4|
|vsc-material-theme|Equinusocio|30.0.0|
|vscode-azureappservice|ms-azuretools|0.16.1|
|vscode-npm|fknop|3.3.0|
|vscode-npm-script|eg2|0.3.9|
|vscode-react-native|msjsdiag|0.13.1|;

Most helpful comment

please update mono 5.2.0 to 6.4.0

All 10 comments

please update mono 5.2.0 to 6.4.0

please update mono 5.2.0 to 6.4.0

Can confirm that this worked for me. I upgraded from Mono 5.18.0 -> 6.4.0 and am no longer seeing this error.

Is there a way to tell VSCode to use a different path for mono? I have it installed via Homebrew so its located in /usr/local/Cellar/mono/6.4.0.198

Found it.

"omnisharp.useGlobalMono": "auto",
"omnisharp.monoPath": "/usr/local/Cellar/mono/6.4.0.198",

I did it just like you did, but it does not take effect,
"omnisharp.useGlobalMono": "auto",
"omnisharp.monoPath": "/Library/Frameworks/Mono.framework/Versions/6.10.0",

andThen vscode still use build-in MSBuild
OmniSharp.MSBuild.Discovery.MSBuildLocator
Located 1 MSBuild instance(s)
1: StandAlone 16.8.0
if I change "auto" to "always" , it takes effect like below

Located 2 MSBuild instance(s)
1: Mono 16.8.0 - "/Library/Frameworks/Mono.framework/Versions/6.10.0/lib/mono/msbuild/Current/bin"
2: StandAlone 16.8.0 -

    Registered MSBuild instance: Mono 16.8.0 - "/Library/Frameworks/Mono.framework/Versions/6.10.0/lib/mono/msbuild/Current/bin"

I wonder why "auto" does not take effect like it says "If set to "auto", OmniSharp will be launched with "mono" if version 6.4.0 or greater is available on the PATH"

the meaning of auto was changed from always to never in 1.23.1 due to an MSBuild issue https://github.com/OmniSharp/omnisharp-vscode#whats-new-in-1231

So how can I make it work correct when I want OmniSharp starts with specified MSBuild instance. I really don't want to change between "auto" and "always" when I develop between .Net-core and mono(unity3d);

macOx Catalina
vscode August 2020 (version 1.49)
mono 6.10.0
.netCore 3.1.402

vscode extensions

C# 1.23.2
Mono Debug 0.15.8

@CodeWu91 This isn't an ideal suggestion, but you could run both VS Code and VS Code Insiders. Configure one to use for .NET Core apps and the other for Unity.

You could set individual project settings by using workspaces settings. I guess it depends how many projects of each type you have.

On 23 Sep 2020, at 21:09, Joey Robichaud notifications@github.com wrote:


@CodeWu91 This isn't an ideal suggestion, but you could run both VS Code and VS Code Insiders. Configure one to use for .NET Core apps and the other for Unity.

—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub, or unsubscribe.

While looking at workspaces I found this references language specific settings that may help @CodeWu91 https://vscode.readthedocs.io/en/latest/getstarted/settings/

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mshinnie picture mshinnie  Â·  3Comments

visten picture visten  Â·  4Comments

mattwoberts picture mattwoberts  Â·  3Comments

IdeoG picture IdeoG  Â·  3Comments

ghost picture ghost  Â·  3Comments