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

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

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 1
  • Comments: 23 (5 by maintainers)

Most upvoted comments

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

Thought I solved this buy removing my folder and cloning a new copy, but the second the OmniSharp update you back to the error The terminal process failed to launch: Path to shell executable “dotnet” does not exist.

    Failed to load project file '{projectFilePath}'.

Microsoft.Build.Exceptions.InvalidProjectFileException: The SDK ‘Microsoft.NET.Sdk.Web’ specified could not be found.

  • I have downloaded an updated SDK
  • I changed the dotnet to a full path in tasks only to be presented with another error “” Project not found.
  • I have changed the omnisharp.path to latest, but this just install a beta version.

No idea what is going on here to be honest.

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

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?