Omnisharp-vscode: OmniSharp.MSBuild.ProjectManager Failed to load project file

Created on 28 Apr 2018  ·  20Comments  ·  Source: OmniSharp/omnisharp-vscode

Environment data

dotnet --info output:

rray@~/VisualStudioProjects/.vscode/HelloWorld| => dotnet --info
.NET Command Line Tools (2.1.105)

Product Information:
 Version:            2.1.105
 Commit SHA-1 hash:  141cc8d976

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/2.1.105/

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.7
  Build    : 2d61d0b043915bc948ebf98836fefe9ba942be11

VS Code version: 1.22.2

C# Extension version: ms-vscode.csharp-1.14.0

Steps to reproduce

Build or run from VS Code

Expected behavior

no errors

Actual behavior

Starting OmniSharp server at 2018-4-28 07:25:36
    Target: /Users/rray/VisualStudioProjects/.vscode/HelloWorld

OmniSharp server started wth Mono
    Path: /Users/rray/.vscode/extensions/ms-vscode.csharp-1.14.0/.omnisharp/run
    PID: 39210

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on MacOS 10.13.4 (x64)
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 1 MSBuild instance(s)
            1: StandAlone 15.0 - "/Users/rray/.vscode/extensions/ms-vscode.csharp-1.14.0/.omnisharp/omnisharp/msbuild/15.0/Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        MSBUILD_EXE_PATH environment variable set to '/Users/rray/.vscode/extensions/ms-vscode.csharp-1.14.0/.omnisharp/omnisharp/msbuild/15.0/Bin/MSBuild.dll'
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: StandAlone 15.0 - "/Users/rray/.vscode/extensions/ms-vscode.csharp-1.14.0/.omnisharp/omnisharp/msbuild/15.0/Bin"
            MSBuildExtensionsPath = /Users/rray/.vscode/extensions/ms-vscode.csharp-1.14.0/.omnisharp/omnisharp/msbuild
            CscToolPath = /Users/rray/.vscode/extensions/ms-vscode.csharp-1.14.0/.omnisharp/omnisharp/msbuild/15.0/Bin/Roslyn
            CscToolExe = csc.exe
            MSBuildToolsPath = /Users/rray/.vscode/extensions/ms-vscode.csharp-1.14.0/.omnisharp/omnisharp/msbuild/15.0/Bin
[info]: OmniSharp.Cake.CakeProjectSystem
        Detecting Cake files in '/Users/rray/VisualStudioProjects/.vscode/HelloWorld'.
[info]: OmniSharp.Cake.CakeProjectSystem
        Could not find any Cake files
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Initializing in /Users/rray/VisualStudioProjects/.vscode/HelloWorld
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Auto package restore: False
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Update workspace context
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Resolving projects references
[info]: OmniSharp.MSBuild.ProjectSystem
        No solution files found in '/Users/rray/VisualStudioProjects/.vscode/HelloWorld'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for '/Users/rray/VisualStudioProjects/.vscode/HelloWorld/HelloWorld.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in '/Users/rray/VisualStudioProjects/.vscode/HelloWorld'.
[info]: OmniSharp.Script.ScriptProjectSystem
        Could not find any CSX files
[info]: OmniSharp.Stdio.Host
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpWorkspaceOptionsProvider
[info]: OmniSharp.Stdio.Host
        Configuration finished.
[info]: OmniSharp.Stdio.Host
        Omnisharp server running using Stdio at location '/Users/rray/VisualStudioProjects/.vscode/HelloWorld' on host 39188.
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: /Users/rray/VisualStudioProjects/.vscode/HelloWorld/HelloWorld.csproj
[warn]: OmniSharp.MSBuild.ProjectManager
        Failed to load project file '/Users/rray/VisualStudioProjects/.vscode/HelloWorld/HelloWorld.csproj'.
/Users/rray/VisualStudioProjects/.vscode/HelloWorld/HelloWorld.csproj(1,1)
Microsoft.Build.Exceptions.InvalidProjectFileException: The SDK 'Microsoft.NET.Sdk' specified could not be found.  /Users/rray/VisualStudioProjects/.vscode/HelloWorld/HelloWorld.csproj
Bug Needs More Info OmniSharp

Most helpful comment

I resolved this problem by reinstall the MonoFramework. hope to help u.

All 20 comments

I can tell you this is still an issue with 1.15.2
vs code: 1.23.1 (1.23.1)

dotnet --info
.NET Command Line Tools (2.1.105)

Product Information:
Version: 2.1.105
Commit SHA-1 hash: 141cc8d976

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/2.1.105/

Microsoft .NET Core Shared Framework Host

Version : 2.0.7
Build : 2d61d0b043915bc948ebf98836fefe9ba942be11

@rshillington: Would you mind setting the following option in VS Code? Then, capture the OmniSharp Log again. This may provide more detail that will help determine what's happening.

{
    "omnisharp.loggingLevel": "debug"
}

Same error for me:

```Starting OmniSharp server at 2018-5-24 00:23:44
Target: /home/tybald/Dokumente/Scrumpoker/SinalR Scrumpoker/ScrumPoker.sln

OmniSharp server started
Path: /home/tybald/.var/app/com.visualstudio.code/data/vscode/extensions/ms-vscode.csharp-1.15.2/.omnisharp/1.30.1/run
PID: 210

[info]: OmniSharp.Stdio.Host
Starting OmniSharp on org.freedesktop.Platform 1.6 (x64)
Could not retrieve Mono runtime path
Located 1 MSBuild instance(s)
1: StandAlone 15.0 - "/home/tybald/.var/app/com.visualstudio.code/data/vscode/extensions/ms-vscode.csharp-1.15.2/.omnisharp/1.30.1/omnisharp/msbuild/15.0/Bin"
Resolved 'Microsoft.Build.Utilities.Core' to '/home/tybald/.var/app/com.visualstudio.code/data/vscode/extensions/ms-vscode.csharp-1.15.2/.omnisharp/1.30.1/omnisharp/msbuild/15.0/Bin/Microsoft.Build.Utilities.Core.dll'
Resolved 'Microsoft.Build.Tasks.Core' to '/home/tybald/.var/app/com.visualstudio.code/data/vscode/extensions/ms-vscode.csharp-1.15.2/.omnisharp/1.30.1/omnisharp/msbuild/15.0/Bin/Microsoft.Build.Tasks.Core.dll'
Resolved 'Microsoft.Build.Framework' to '/home/tybald/.var/app/com.visualstudio.code/data/vscode/extensions/ms-vscode.csharp-1.15.2/.omnisharp/1.30.1/omnisharp/msbuild/15.0/Bin/Microsoft.Build.Framework.dll'
Resolved 'Microsoft.Build' to '/home/tybald/.var/app/com.visualstudio.code/data/vscode/extensions/ms-vscode.csharp-1.15.2/.omnisharp/1.30.1/omnisharp/msbuild/15.0/Bin/Microsoft.Build.dll'
MSBUILD_EXE_PATH environment variable set to '/home/tybald/.var/app/com.visualstudio.code/data/vscode/extensions/ms-vscode.csharp-1.15.2/.omnisharp/1.30.1/omnisharp/msbuild/15.0/Bin/MSBuild.dll'
Registered MSBuild instance: StandAlone 15.0 - "/home/tybald/.var/app/com.visualstudio.code/data/vscode/extensions/ms-vscode.csharp-1.15.2/.omnisharp/1.30.1/omnisharp/msbuild/15.0/Bin"
MSBuildExtensionsPath = /home/tybald/.var/app/com.visualstudio.code/data/vscode/extensions/ms-vscode.csharp-1.15.2/.omnisharp/1.30.1/omnisharp/msbuild
BypassFrameworkInstallChecks = true
CscToolPath = /home/tybald/.var/app/com.visualstudio.code/data/vscode/extensions/ms-vscode.csharp-1.15.2/.omnisharp/1.30.1/omnisharp/msbuild/15.0/Bin/Roslyn
CscToolExe = csc.exe
MSBuildToolsPath = /home/tybald/.var/app/com.visualstudio.code/data/vscode/extensions/ms-vscode.csharp-1.15.2/.omnisharp/1.30.1/omnisharp/msbuild/15.0/Bin
Attempting to resolve 'Microsoft.CodeAnalysis.VisualBasic.Workspaces, Version=2.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
Attempting to resolve 'Microsoft.CodeAnalysis.VisualBasic.Features, Version=2.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
Detecting Cake files in '/home/tybald/Dokumente/Scrumpoker/SinalR Scrumpoker'.
Could not find any Cake files
Initializing in /home/tybald/Dokumente/Scrumpoker/SinalR Scrumpoker
Auto package restore: False
Update workspace context
Resolving projects references
MSBuild environment:
Mode: Standalone
RunningTests: False
RunningInVisualStudio: False
MSBuildToolsDirectory32: /home/tybald/.var/app/com.visualstudio.code/data/vscode/extensions/ms-vscode.csharp-1.15.2/.omnisharp/1.30.1/omnisharp/msbuild/15.0/Bin
MSBuildToolsDirectory64: /home/tybald/.var/app/com.visualstudio.code/data/vscode/extensions/ms-vscode.csharp-1.15.2/.omnisharp/1.30.1/omnisharp/msbuild/15.0/Bin
MSBuildSDKsPath: /home/tybald/.var/app/com.visualstudio.code/data/vscode/extensions/ms-vscode.csharp-1.15.2/.omnisharp/1.30.1/omnisharp/msbuild/15.0/Bin/Sdks
CurrentMSBuildConfigurationFile: /home/tybald/.var/app/com.visualstudio.code/data/vscode/extensions/ms-vscode.csharp-1.15.2/.omnisharp/1.30.1/omnisharp/msbuild/15.0/Bin/MSBuild.dll.config
CurrentMSBuildExePath: /home/tybald/.var/app/com.visualstudio.code/data/vscode/extensions/ms-vscode.csharp-1.15.2/.omnisharp/1.30.1/omnisharp/msbuild/15.0/Bin/MSBuild.dll
CurrentMSBuildToolsDirectory: /home/tybald/.var/app/com.visualstudio.code/data/vscode/extensions/ms-vscode.csharp-1.15.2/.omnisharp/1.30.1/omnisharp/msbuild/15.0/Bin
VisualStudioInstallRootDirectory:
MSBuildExtensionsPath: /home/tybald/.var/app/com.visualstudio.code/data/vscode/extensions/ms-vscode.csharp-1.15.2/.omnisharp/1.30.1/omnisharp/msbuild/15.0/Bin

    Detecting projects in '/home/tybald/Dokumente/Scrumpoker/SinalR Scrumpoker/ScrumPoker.sln'.
    Queue project update for '/home/tybald/Dokumente/Scrumpoker/SinalR Scrumpoker/ScrumPoker/ScrumPoker.Business/ScrumPoker.Business.csproj'
    Queue project update for '/home/tybald/Dokumente/Scrumpoker/SinalR Scrumpoker/ScrumPokerCore/ScrumPokerCore/ScrumPokerCore.csproj'
    Attempting to resolve 'System.Runtime.Loader, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
    Detecting CSX files in '/home/tybald/Dokumente/Scrumpoker/SinalR Scrumpoker'.
    Could not find any CSX files
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpWorkspaceOptionsProvider
    Configuration finished.
    Omnisharp server running using Stdio at location '/home/tybald/Dokumente/Scrumpoker/SinalR Scrumpoker' on host 113.
    Loading project: /home/tybald/Dokumente/Scrumpoker/SinalR Scrumpoker/ScrumPoker/ScrumPoker.Business/ScrumPoker.Business.csproj
    ************ Request ************

{
"Type": "request",
"Seq": 1,
"Command": "/projects"
}
*** Request ***
{
"Type": "request",
"Seq": 2,
"Command": "/projects"
}
Attempting to resolve 'Microsoft.Build.resources, Version=15.1.0.0, Culture=de-DE, PublicKeyToken=b03f5f7f11d50a3a'
Attempting to resolve 'Microsoft.Build.resources, Version=15.1.0.0, Culture=de, PublicKeyToken=b03f5f7f11d50a3a'
Attempting to resolve 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
Attempting to resolve 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
Failed to load project file '/home/tybald/Dokumente/Scrumpoker/SinalR Scrumpoker/ScrumPoker/ScrumPoker.Business/ScrumPoker.Business.csproj'.
/home/tybald/Dokumente/Scrumpoker/SinalR Scrumpoker/ScrumPoker/ScrumPoker.Business/ScrumPoker.Business.csproj(1,1)
Microsoft.Build.Exceptions.InvalidProjectFileException: The SDK 'Microsoft.NET.Sdk' specified could not be found. /home/tybald/Dokumente/Scrumpoker/SinalR Scrumpoker/ScrumPoker/ScrumPoker.Business/ScrumPoker.Business.csproj
at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject (System.String errorSubCategoryResourceName, Microsoft.Build.Shared.IElementLocation elementLocation, System.String resourceName, System.Object[] args) [0x00042] in <61115f75067146fab35b10183e6ee379>:0
at Microsoft.Build.Shared.ProjectErrorUtilities.VerifyThrowInvalidProject[T1] (System.Boolean condition, System.String errorSubCategoryResourceName, Microsoft.Build.Shared.IElementLocation elementLocation, System.String resourceName, T1 arg0) [0x00003] in <61115f75067146fab35b10183e6ee379>:0
at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject[T1] (Microsoft.Build.Shared.IElementLocation elementLocation, System.String resourceName, T1 arg0) [0x00000] in <61115f75067146fab35b10183e6ee379>:0
at Microsoft.Build.Evaluation.Evaluator4[P,I,M,D].ExpandAndLoadImportsFromUnescapedImportExpressionConditioned (System.String directoryOfImportingFile, Microsoft.Build.Construction.ProjectImportElement importElement, System.Collections.Generic.List1[Microsoft.Build.Construction.ProjectRootElement]& projects, System.Boolean throwOnFileNotExistsError) [0x0019e] in <61115f75067146fab35b10183e6ee379>:0
at Microsoft.Build.Evaluation.Evaluator4[P,I,M,D].ExpandAndLoadImports (System.String directoryOfImportingFile, Microsoft.Build.Construction.ProjectImportElement importElement) [0x00024] in <61115f75067146fab35b10183e6ee379>:0 at Microsoft.Build.Evaluation.Evaluator4[P,I,M,D].EvaluateImportElement (System.String directoryOfImportingFile, Microsoft.Build.Construction.ProjectImportElement importElement) [0x0000d] in <61115f75067146fab35b10183e6ee379>:0
at Microsoft.Build.Evaluation.Evaluator4[P,I,M,D].PerformDepthFirstPass (Microsoft.Build.Construction.ProjectRootElement currentProjectOrImport) [0x000e6] in <61115f75067146fab35b10183e6ee379>:0 at Microsoft.Build.Evaluation.Evaluator4[P,I,M,D].Evaluate (Microsoft.Build.BackEnd.Logging.ILoggingService loggingService, Microsoft.Build.Framework.BuildEventContext buildEventContext) [0x000f8] in <61115f75067146fab35b10183e6ee379>:0
at Microsoft.Build.Evaluation.Evaluator4[P,I,M,D].Evaluate (Microsoft.Build.Evaluation.IEvaluatorData4[P,I,M,D] data, Microsoft.Build.Construction.ProjectRootElement root, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings, System.Int32 maxNodeCount, Microsoft.Build.Collections.PropertyDictionary1[T] environmentProperties, Microsoft.Build.BackEnd.Logging.ILoggingService loggingService, Microsoft.Build.Evaluation.IItemFactory2[S,T] itemFactory, Microsoft.Build.Evaluation.IToolsetProvider toolsetProvider, Microsoft.Build.Evaluation.ProjectRootElementCache projectRootElementCache, Microsoft.Build.Framework.BuildEventContext buildEventContext, Microsoft.Build.Execution.ProjectInstance projectInstanceIfAnyForDebuggerOnly, Microsoft.Build.BackEnd.SdkResolution.ISdkResolverService sdkResolverService, System.Int32 submissionId) [0x00018] in <61115f75067146fab35b10183e6ee379>:0
at Microsoft.Build.Evaluation.Project.Reevaluate (Microsoft.Build.BackEnd.Logging.ILoggingService loggingServiceForEvaluation, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings) [0x00046] in <61115f75067146fab35b10183e6ee379>:0
at Microsoft.Build.Evaluation.Project.ReevaluateIfNecessary (Microsoft.Build.BackEnd.Logging.ILoggingService loggingServiceForEvaluation, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings) [0x00034] in <61115f75067146fab35b10183e6ee379>:0
at Microsoft.Build.Evaluation.Project.ReevaluateIfNecessary (Microsoft.Build.BackEnd.Logging.ILoggingService loggingServiceForEvaluation) [0x00000] in <61115f75067146fab35b10183e6ee379>:0
at Microsoft.Build.Evaluation.Project.ReevaluateIfNecessary () [0x00007] in <61115f75067146fab35b10183e6ee379>:0
at Microsoft.Build.Evaluation.Project.Initialize (System.Collections.Generic.IDictionary2[TKey,TValue] globalProperties, System.String toolsVersion, System.String subToolsetVersion, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings) [0x00126] in <61115f75067146fab35b10183e6ee379>:0 at Microsoft.Build.Evaluation.Project..ctor (System.String projectFile, System.Collections.Generic.IDictionary2[TKey,TValue] globalProperties, System.String toolsVersion, System.String subToolsetVersion, Microsoft.Build.Evaluation.ProjectCollection projectCollection, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings) [0x0009c] in <61115f75067146fab35b10183e6ee379>:0
at Microsoft.Build.Evaluation.Project..ctor (System.String projectFile, System.Collections.Generic.IDictionary2[TKey,TValue] globalProperties, System.String toolsVersion, Microsoft.Build.Evaluation.ProjectCollection projectCollection, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings) [0x00000] in <61115f75067146fab35b10183e6ee379>:0 at Microsoft.Build.Evaluation.Project..ctor (System.String projectFile, System.Collections.Generic.IDictionary2[TKey,TValue] globalProperties, System.String toolsVersion, Microsoft.Build.Evaluation.ProjectCollection projectCollection) [0x00000] in <61115f75067146fab35b10183e6ee379>:0
at Microsoft.Build.Evaluation.ProjectCollection.LoadProject (System.String fileName, System.Collections.Generic.IDictionary2[TKey,TValue] globalProperties, System.String toolsVersion) [0x000f5] in <61115f75067146fab35b10183e6ee379>:0 at Microsoft.Build.Evaluation.ProjectCollection.LoadProject (System.String fileName, System.String toolsVersion) [0x00000] in <61115f75067146fab35b10183e6ee379>:0 at OmniSharp.MSBuild.ProjectLoader.EvaluateProjectFileCore (System.String filePath) [0x0003e] in <310950e56f5c4adf8cba1b4e3af76cf5>:0 at OmniSharp.MSBuild.ProjectLoader.BuildProject (System.String filePath) [0x0000d] in <310950e56f5c4adf8cba1b4e3af76cf5>:0 at OmniSharp.MSBuild.ProjectFile.ProjectFileInfo.Load (System.String filePath, OmniSharp.MSBuild.ProjectLoader loader) [0x00014] in <310950e56f5c4adf8cba1b4e3af76cf5>:0 at OmniSharp.MSBuild.ProjectManager+<>c__DisplayClass23_0.<LoadProject>b__0 () [0x00000] in <310950e56f5c4adf8cba1b4e3af76cf5>:0 at (wrapper delegate-invoke) System.Func1[System.ValueTuple2[OmniSharp.MSBuild.ProjectFile.ProjectFileInfo,System.Collections.Immutable.ImmutableArray1[OmniSharp.MSBuild.Logging.MSBuildDiagnostic]]].invoke_TResult()
at OmniSharp.MSBuild.ProjectManager.LoadOrReloadProject (System.String projectFilePath, System.Func`1[TResult] loadFunc) [0x0001b] in <310950e56f5c4adf8cba1b4e3af76cf5>:0 ```

@Tynamix: Could you try setting the "omnisharp.path" option in the VS Code settings to "latest" and see if anything changes?

I'm having the same issue; setting omnisharp.path to latest did not fix it. Log available here

VS Code v1.24.0

dotnet --info

.NET Core SDK (reflecting any global.json):
 Version:   2.1.300
 Commit:    adab45bf0c

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/2.1.300/

Host (useful for support):
  Version: 2.1.0
  Commit:  caa7b7e2ba

.NET Core SDKs installed:
  2.1.300 [/usr/local/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

@colinthompson: Could you provide your OmniSharp Log?

This issue sounds a lot like https://github.com/OmniSharp/omnisharp-vscode/issues/2330. In that issue, it seems like there is a difference between the PATH when launch VS Code via the macOS LaunchPad or by typing code at a Terminal window. In the latter case, C# for VS Code worked fine. Could you try that and let me know if this is the same behavior you're seeing?

I regularly launch VS Code via the dock, Alfred, and the command line, and don't recall it making a difference. I've only encountered the issue intermittently and haven't yet figured out how to reproduce it: I'll double-check whether the launch method changes things when I next run into problems.

For what it's worth, I found that deleting most of the dotnet related folders in my home directory and then restarting VS Code seemed to fix things. I haven't been able to pin down exactly which combination of folders made the difference, so I've been deleting:

  • ~/.aspnet
  • ~/.dotnet
  • ~/.local/share/NuGet
  • ~/.mono
  • ~/.nuget
  • ~/.omnisharp

I get a similar issue using omnisharp-linux-x86_64 v1.31.2.beta21 through LSP in Eclipse IDE.
I tried deleting all the folders mentioned in previous comment but it didn't change anything.

I resolved this problem by reinstall the MonoFramework. hope to help u.

I'm getting this error on Linux. I think it's general to all .NET Core installations on non-Windows.
It's a really strong regression IMO. 1.29.x used to work fine on Linux with just dotnet-core installed, and now it's almost impossible to figure out a way to get more recent versions to work...

I've tried several versions of OmniSharp on Linux with dotnet --info > .NET Core SDK (reflecting any global.json): Version: 2.1.401, and concluded that

  • versions 1.30.1 and earlier are working properly ✔️
  • versions 1.31.0 and later all fail the same way ❌

Were some mandatory configuration flags added in the 1.31 stream?

same error on

.NET Core SDK (reflecting any global.json):
 Version:   2.1.403
 Commit:    04e15494b6

Runtime Environment:
 OS Name:     linuxmint
 OS Version:  18.3
 OS Platform: Linux
 RID:         linuxmint.18.3-x64
 Base Path:   /usr/share/dotnet/sdk/2.1.403/

Host (useful for support):
  Version: 2.1.5
  Commit:  290303f510

.NET Core SDKs installed:
  2.1.403 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.5 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.5 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.5 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

this error happened

Starting OmniSharp server at 10/17/2018, 10:53:26 PM
    Target: /home/smn/Desktop/PayPing/Products/PayPing.Products.sln

OmniSharp server started with Mono 5.16.0 (/usr/bin/mono).
    Path: /home/smn/.vscode/extensions/ms-vscode.csharp-1.16.2/.omnisharp/1.32.5/omnisharp/OmniSharp.exe
    PID: 22723

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on linuxmint 18.3 (x64)
[info]: OmniSharp.Services.DotNetCliService
        DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 2 MSBuild instance(s)
            1: Mono 15.0 - "/usr/lib/mono/msbuild/15.0/bin"
            2: StandAlone 15.0 - "/home/smn/.vscode/extensions/ms-vscode.csharp-1.16.2/.omnisharp/1.32.5/omnisharp/msbuild/15.0/Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: Mono 15.0 - "/usr/lib/mono/msbuild/15.0/bin"
            CscToolPath = /home/smn/.vscode/extensions/ms-vscode.csharp-1.16.2/.omnisharp/1.32.5/omnisharp/msbuild/15.0/Bin/Roslyn
            CscToolExe = csc.exe
[info]: OmniSharp.Cake.CakeProjectSystem
        Detecting Cake files in '/home/smn/Desktop/PayPing/Products'.
[info]: OmniSharp.Cake.CakeProjectSystem
        Could not find any Cake files
[info]: OmniSharp.WorkspaceInitializer
        Project system 'OmniSharp.DotNet.DotNetProjectSystem' is disabled in the configuration.
[info]: OmniSharp.MSBuild.ProjectSystem
        Detecting projects in '/home/smn/Desktop/PayPing/Products/PayPing.Products.sln'.
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for '/home/smn/Desktop/PayPing/Products/src/PayPing.Products.DataLayer/PayPing.Products.DataLayer.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for '/home/smn/Desktop/PayPing/Products/src/PayPing.Products.Entities/PayPing.Products.Entities.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for '/home/smn/Desktop/PayPing/Products/src/PayPing.Products.ModelLayer/PayPing.Products.ModelLayer.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for '/home/smn/Desktop/PayPing/Products/src/PayPing.Products.ServiceLayer/PayPing.Products.ServiceLayer.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for '/home/smn/Desktop/PayPing/Products/src/PayPing.Products/PayPing.Products.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in '/home/smn/Desktop/PayPing/Products'.
[info]: OmniSharp.Script.ScriptProjectSystem
        Could not find any CSX files
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpWorkspaceOptionsProvider
[info]: OmniSharp.WorkspaceInitializer
        Configuration finished.
[info]: OmniSharp.Stdio.Host
        Omnisharp server running using Stdio at location '/home/smn/Desktop/PayPing/Products' on host 22609.
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: /home/smn/Desktop/PayPing/Products/src/PayPing.Products.DataLayer/PayPing.Products.DataLayer.csproj
[warn]: OmniSharp.MSBuild.ProjectLoader
        Microsoft.Extensions.Primitives 2.0.0-preview1-final depends on System.Runtime.CompilerServices.Unsafe (>= 4.4.0-preview1-25219-04) but System.Runtime.CompilerServices.Unsafe 4.4.0-preview1-25219-04 was not found. An approximate best match of System.Runtime.CompilerServices.Unsafe 4.4.0-preview1-25305-02 was resolved.
[info]: OmniSharp.MSBuild.ProjectManager
        Successfully loaded project file '/home/smn/Desktop/PayPing/Products/src/PayPing.Products.DataLayer/PayPing.Products.DataLayer.csproj'.
/home/smn/Desktop/PayPing/Products/src/PayPing.Products.DataLayer/PayPing.Products.DataLayer.csproj
/home/smn/Desktop/PayPing/Products/src/PayPing.Products.DataLayer/PayPing.Products.DataLayer.csproj(0,0): Error: Microsoft.Extensions.Primitives 2.0.0-preview1-final depends on System.Runtime.CompilerServices.Unsafe (>= 4.4.0-preview1-25219-04) but System.Runtime.CompilerServices.Unsafe 4.4.0-preview1-25219-04 was not found. An approximate best match of System.Runtime.CompilerServices.Unsafe 4.4.0-preview1-25305-02 was resolved.

[info]: OmniSharp.MSBuild.ProjectManager
        Adding project '/home/smn/Desktop/PayPing/Products/src/PayPing.Products.DataLayer/PayPing.Products.DataLayer.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: /home/smn/Desktop/PayPing/Products/src/PayPing.Products.Entities/PayPing.Products.Entities.csproj
[info]: OmniSharp.MSBuild.ProjectManager
        Successfully loaded project file '/home/smn/Desktop/PayPing/Products/src/PayPing.Products.Entities/PayPing.Products.Entities.csproj'.
[info]: OmniSharp.MSBuild.ProjectManager
        Adding project '/home/smn/Desktop/PayPing/Products/src/PayPing.Products.Entities/PayPing.Products.Entities.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: /home/smn/Desktop/PayPing/Products/src/PayPing.Products.ModelLayer/PayPing.Products.ModelLayer.csproj
[info]: OmniSharp.MSBuild.ProjectManager
        Successfully loaded project file '/home/smn/Desktop/PayPing/Products/src/PayPing.Products.ModelLayer/PayPing.Products.ModelLayer.csproj'.
[info]: OmniSharp.MSBuild.ProjectManager
        Adding project '/home/smn/Desktop/PayPing/Products/src/PayPing.Products.ModelLayer/PayPing.Products.ModelLayer.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: /home/smn/Desktop/PayPing/Products/src/PayPing.Products.ServiceLayer/PayPing.Products.ServiceLayer.csproj
[warn]: OmniSharp.MSBuild.ProjectLoader
        Microsoft.Extensions.Primitives 2.0.0-preview1-final depends on System.Runtime.CompilerServices.Unsafe (>= 4.4.0-preview1-25219-04) but System.Runtime.CompilerServices.Unsafe 4.4.0-preview1-25219-04 was not found. An approximate best match of System.Runtime.CompilerServices.Unsafe 4.4.0-preview1-25305-02 was resolved.
[info]: OmniSharp.MSBuild.ProjectManager
        Successfully loaded project file '/home/smn/Desktop/PayPing/Products/src/PayPing.Products.ServiceLayer/PayPing.Products.ServiceLayer.csproj'.
/home/smn/Desktop/PayPing/Products/src/PayPing.Products.ServiceLayer/PayPing.Products.ServiceLayer.csproj
/home/smn/Desktop/PayPing/Products/src/PayPing.Products.ServiceLayer/PayPing.Products.ServiceLayer.csproj(0,0): Error: Microsoft.Extensions.Primitives 2.0.0-preview1-final depends on System.Runtime.CompilerServices.Unsafe (>= 4.4.0-preview1-25219-04) but System.Runtime.CompilerServices.Unsafe 4.4.0-preview1-25219-04 was not found. An approximate best match of System.Runtime.CompilerServices.Unsafe 4.4.0-preview1-25305-02 was resolved.

[info]: OmniSharp.MSBuild.ProjectManager
        Adding project '/home/smn/Desktop/PayPing/Products/src/PayPing.Products.ServiceLayer/PayPing.Products.ServiceLayer.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: /home/smn/Desktop/PayPing/Products/src/PayPing.Products/PayPing.Products.csproj
[warn]: OmniSharp.MSBuild.ProjectManager
        Failed to load project file '/home/smn/Desktop/PayPing/Products/src/PayPing.Products/PayPing.Products.csproj'.
/home/smn/Desktop/PayPing/Products/src/PayPing.Products/PayPing.Products.csproj(1,1)
Microsoft.Build.Exceptions.InvalidProjectFileException: The SDK 'Microsoft.NET.Sdk.Razor' specified could not be found.  /usr/lib/mono/msbuild/15.0/bin/Sdks/Microsoft.NET.Sdk.Web/Sdk/Sdk.props
  at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject (System.String errorSubCategoryResourceName, Microsoft.Build.Shared.IElementLocation elementLocation, System.String resourceName, System.Object[] args) [0x00040] in <63bca7756d124ea392a81ca1b2d26b9c>:0 
  at Microsoft.Build.Shared.ProjectErrorUtilities.VerifyThrowInvalidProject[T1] (System.Boolean condition, System.String errorSubCategoryResourceName, Microsoft.Build.Shared.IElementLocation elementLocation, System.String resourceName, T1 arg0) [0x00003] in <63bca7756d124ea392a81ca1b2d26b9c>:0 
  at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject[T1] (Microsoft.Build.Shared.IElementLocation elementLocation, System.String resourceName, T1 arg0) [0x00000] in <63bca7756d124ea392a81ca1b2d26b9c>:0 
  at Microsoft.Build.Evaluation.Evaluator`4[P,I,M,D].ExpandAndLoadImportsFromUnescapedImportExpressionConditioned (System.String directoryOfImportingFile, Microsoft.Build.Construction.ProjectImportElement importElement, System.Collections.Generic.List`1[Microsoft.Build.Construction.ProjectRootElement]& projects, Microsoft.Build.BackEnd.SdkResolution.SdkResult& sdkResult, System.Boolean throwOnFileNotExistsError) [0x0024e] in <63bca7756d124ea392a81ca1b2d26b9c>:0 
  at Microsoft.Build.Evaluation.Evaluator`4[P,I,M,D].ExpandAndLoadImports (System.String directoryOfImportingFile, Microsoft.Build.Construction.ProjectImportElement importElement, Microsoft.Build.BackEnd.SdkResolution.SdkResult& sdkResult) [0x00027] in <63bca7756d124ea392a81ca1b2d26b9c>:0 
  at Microsoft.Build.Evaluation.Evaluator`4[P,I,M,D].EvaluateImportElement (System.String directoryOfImportingFile, Microsoft.Build.Construction.ProjectImportElement importElement) [0x0000d] in <63bca7756d124ea392a81ca1b2d26b9c>:0 
  at Microsoft.Build.Evaluation.Evaluator`4[P,I,M,D].PerformDepthFirstPass (Microsoft.Build.Construction.ProjectRootElement currentProjectOrImport) [0x00209] in <63bca7756d124ea392a81ca1b2d26b9c>:0 
  at Microsoft.Build.Evaluation.Evaluator`4[P,I,M,D].EvaluateImportElement (System.String directoryOfImportingFile, Microsoft.Build.Construction.ProjectImportElement importElement) [0x00040] in <63bca7756d124ea392a81ca1b2d26b9c>:0 
  at Microsoft.Build.Evaluation.Evaluator`4[P,I,M,D].PerformDepthFirstPass (Microsoft.Build.Construction.ProjectRootElement currentProjectOrImport) [0x000e6] in <63bca7756d124ea392a81ca1b2d26b9c>:0 
  at Microsoft.Build.Evaluation.Evaluator`4[P,I,M,D].Evaluate (Microsoft.Build.BackEnd.Logging.ILoggingService loggingService, Microsoft.Build.Framework.BuildEventContext buildEventContext) [0x00103] in <63bca7756d124ea392a81ca1b2d26b9c>:0 
  at Microsoft.Build.Evaluation.Evaluator`4[P,I,M,D].Evaluate (Microsoft.Build.Evaluation.IEvaluatorData`4[P,I,M,D] data, Microsoft.Build.Construction.ProjectRootElement root, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings, System.Int32 maxNodeCount, Microsoft.Build.Collections.PropertyDictionary`1[T] environmentProperties, Microsoft.Build.BackEnd.Logging.ILoggingService loggingService, Microsoft.Build.Evaluation.IItemFactory`2[S,T] itemFactory, Microsoft.Build.Evaluation.IToolsetProvider toolsetProvider, Microsoft.Build.Evaluation.ProjectRootElementCache projectRootElementCache, Microsoft.Build.Framework.BuildEventContext buildEventContext, Microsoft.Build.Execution.ProjectInstance projectInstanceIfAnyForDebuggerOnly, Microsoft.Build.BackEnd.SdkResolution.ISdkResolverService sdkResolverService, System.Int32 submissionId, Microsoft.Build.Evaluation.Context.EvaluationContext evaluationContext) [0x0001a] in <63bca7756d124ea392a81ca1b2d26b9c>:0 
  at Microsoft.Build.Evaluation.Project.Reevaluate (Microsoft.Build.BackEnd.Logging.ILoggingService loggingServiceForEvaluation, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings) [0x0004c] in <63bca7756d124ea392a81ca1b2d26b9c>:0 
  at Microsoft.Build.Evaluation.Project.ReevaluateIfNecessary (Microsoft.Build.BackEnd.Logging.ILoggingService loggingServiceForEvaluation, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings) [0x00034] in <63bca7756d124ea392a81ca1b2d26b9c>:0 
  at Microsoft.Build.Evaluation.Project.ReevaluateIfNecessary (Microsoft.Build.BackEnd.Logging.ILoggingService loggingServiceForEvaluation) [0x00000] in <63bca7756d124ea392a81ca1b2d26b9c>:0 
  at Microsoft.Build.Evaluation.Project.ReevaluateIfNecessary (Microsoft.Build.Evaluation.Context.EvaluationContext evaluationContext) [0x00023] in <63bca7756d124ea392a81ca1b2d26b9c>:0 
  at Microsoft.Build.Evaluation.Project.Initialize (System.Collections.Generic.IDictionary`2[TKey,TValue] globalProperties, System.String toolsVersion, System.String subToolsetVersion, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings, Microsoft.Build.Evaluation.Context.EvaluationContext evaluationContext) [0x00126] in <63bca7756d124ea392a81ca1b2d26b9c>:0 
  at Microsoft.Build.Evaluation.Project..ctor (System.String projectFile, System.Collections.Generic.IDictionary`2[TKey,TValue] globalProperties, System.String toolsVersion, System.String subToolsetVersion, Microsoft.Build.Evaluation.ProjectCollection projectCollection, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings, Microsoft.Build.Evaluation.Context.EvaluationContext evaluationContext) [0x0009e] in <63bca7756d124ea392a81ca1b2d26b9c>:0 
  at Microsoft.Build.Evaluation.Project..ctor (System.String projectFile, System.Collections.Generic.IDictionary`2[TKey,TValue] globalProperties, System.String toolsVersion, System.String subToolsetVersion, Microsoft.Build.Evaluation.ProjectCollection projectCollection, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings) [0x00000] in <63bca7756d124ea392a81ca1b2d26b9c>:0 
  at Microsoft.Build.Evaluation.Project..ctor (System.String projectFile, System.Collections.Generic.IDictionary`2[TKey,TValue] globalProperties, System.String toolsVersion, Microsoft.Build.Evaluation.ProjectCollection projectCollection, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings) [0x00000] in <63bca7756d124ea392a81ca1b2d26b9c>:0 
  at Microsoft.Build.Evaluation.Project..ctor (System.String projectFile, System.Collections.Generic.IDictionary`2[TKey,TValue] globalProperties, System.String toolsVersion, Microsoft.Build.Evaluation.ProjectCollection projectCollection) [0x00000] in <63bca7756d124ea392a81ca1b2d26b9c>:0 
  at Microsoft.Build.Evaluation.ProjectCollection.LoadProject (System.String fileName, System.Collections.Generic.IDictionary`2[TKey,TValue] globalProperties, System.String toolsVersion) [0x000f7] in <63bca7756d124ea392a81ca1b2d26b9c>:0 
  at Microsoft.Build.Evaluation.ProjectCollection.LoadProject (System.String fileName, System.String toolsVersion) [0x00000] in <63bca7756d124ea392a81ca1b2d26b9c>:0 
  at OmniSharp.MSBuild.ProjectLoader.EvaluateProjectFileCore (System.String filePath) [0x0003e] in <99f3a3b619ce4010a7d6d489ffd5bcf1>:0 
  at OmniSharp.MSBuild.ProjectLoader.BuildProject (System.String filePath) [0x0000d] in <99f3a3b619ce4010a7d6d489ffd5bcf1>:0 
  at OmniSharp.MSBuild.ProjectFile.ProjectFileInfo.Load (System.String filePath, OmniSharp.MSBuild.ProjectLoader loader) [0x00015] in <99f3a3b619ce4010a7d6d489ffd5bcf1>:0 
  at OmniSharp.MSBuild.ProjectManager+<>c__DisplayClass25_0.<LoadProject>b__0 () [0x00000] in <99f3a3b619ce4010a7d6d489ffd5bcf1>:0 
  at (wrapper delegate-invoke) System.Func`1[System.ValueTuple`3[OmniSharp.MSBuild.ProjectFile.ProjectFileInfo,System.Collections.Immutable.ImmutableArray`1[OmniSharp.MSBuild.Logging.MSBuildDiagnostic],OmniSharp.MSBuild.Notification.ProjectLoadedEventArgs]].invoke_TResult()
  at OmniSharp.MSBuild.ProjectManager.LoadOrReloadProject (System.String projectFilePath, System.Func`1[TResult] loader) [0x0001b] in <99f3a3b619ce4010a7d6d489ffd5bcf1>:0 

[info]: OmniSharp.MSBuild.ProjectManager
        Update project: PayPing.Products.DataLayer
[info]: OmniSharp.MSBuild.ProjectManager
        Update project: PayPing.Products.Entities
[info]: OmniSharp.MSBuild.ProjectManager
        Update project: PayPing.Products.ModelLayer
[info]: OmniSharp.MSBuild.ProjectManager
        Update project: PayPing.Products.ServiceLayer
[fail]: OmniSharp.MSBuild.ProjectManager
        Attemped to update project that is not loaded: /home/smn/Desktop/PayPing/Products/src/PayPing.Products/PayPing.Products.csproj

@Ashkan-rmk Take a look at https://github.com/OmniSharp/omnisharp-vscode/issues/2604#issuecomment-430330103 for more information on how to diagnose this.

I resolved this problem by reinstall the MonoFramework. hope to help u.

Thanks. This suggestion resolved my issue on Windows

@WellerQu Reinstalling monoFramework did the trick for me, thank you!

I have the same issue (macOS). If anyone needs a repro, it happens on https://github.com/felixfbecker/PowerGit.

I have fix this problem by install .net core 3.1

https://dotnet.microsoft.com/download/dotnet-core

This appears to be an issue related to the interplay between older MSBuilds from .NET Core and Mono. I'll close this out as there was no repro project given to confirm that it works, but folks seem to have reported that things are fine with newer environments.

Was this page helpful?
0 / 5 - 0 ratings