OmniSharp/omnisharp-emacs

OmniSharp.MSBuild.MSBuildProjectSystem, Failed to load project file

doomchild opened this issue · 12 comments

I made a brand new solution and project like so:

$ mkdir temp
$ cd temp
$ dotnet new sln
$ dotnet new console
$ dotnet sln add temp.csproj

Then I opened up ~/temp/Program.cs, started the omnisharp server, and looked at the *omnisharp-log* buffer. Here it is:

[22:46:21] Starting OmniSharpServer using project folder/solution file: /Users/{user}/temp/temp.sln
[22:46:21] Using server binary on /Users/{user}/.emacs.d/.cache/omnisharp/server/v1.26.3/run
[22:46:22] INFORMATION: OmniSharp.Stdio.Host, Starting OmniSharp on MacOS 10.13.3 (x64)
[22:46:22] INFORMATION: OmniSharp.MSBuild.Discovery.MSBuildLocator, Located 1 MSBuild instance(s)
            1: StandAlone 15.0 - "/Users/{user}/.emacs.d/.cache/omnisharp/server/v1.26.3/omnisharp/msbuild/15.0/Bin"
[22:46:22] INFORMATION: OmniSharp.MSBuild.Discovery.MSBuildLocator, MSBUILD_EXE_PATH environment variable set to '/Users/{user}/.emacs.d/.cache/omnisharp/server/v1.26.3/omnisharp/msbuild/15.0/Bin/MSBuild.dll'
[22:46:22] INFORMATION: OmniSharp.MSBuild.Discovery.MSBuildLocator, Registered MSBuild instance: StandAlone 15.0 - "/Users/{user}/.emacs.d/.cache/omnisharp/server/v1.26.3/omnisharp/msbuild/15.0/Bin"
            MSBuildExtensionsPath = /Users/{user}/.emacs.d/.cache/omnisharp/server/v1.26.3/omnisharp/msbuild
            CscToolPath = /Users/{user}/.emacs.d/.cache/omnisharp/server/v1.26.3/omnisharp/msbuild/15.0/Bin/Roslyn
            CscToolExe = csc.exe
            MSBuildToolsPath = /Users/{user}/.emacs.d/.cache/omnisharp/server/v1.26.3/omnisharp/msbuild/15.0/Bin
[22:46:22] INFORMATION: OmniSharp.Cake.CakeProjectSystem, Detecting Cake files in '/Users/{user}/temp'.
[22:46:22] INFORMATION: OmniSharp.Cake.CakeProjectSystem, Could not find any Cake files
[22:46:22] INFORMATION: OmniSharp.DotNet.DotNetProjectSystem, Initializing in /Users/{user}/temp
[22:46:22] INFORMATION: OmniSharp.DotNet.DotNetProjectSystem, Auto package restore: False
[22:46:22] INFORMATION: OmniSharp.DotNet.DotNetProjectSystem, Update workspace context
[22:46:22] INFORMATION: OmniSharp.DotNet.DotNetProjectSystem, Resolving projects references
[22:46:22] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Detecting projects in '/Users/{user}/temp/temp.sln'.
[22:46:22] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /Users/{user}/temp/temp.csproj
[22:46:22] WARNING: OmniSharp.MSBuild.MSBuildProjectSystem, Failed to load project file '/Users/{user}/temp/temp.csproj'.
[22:46:23] INFORMATION: OmniSharp.Script.ScriptProjectSystem, Detecting CSX files in '/Users/{user}/temp'.
[22:46:23] INFORMATION: OmniSharp.Script.ScriptProjectSystem, Could not find any CSX files
[22:46:23] INFORMATION: OmniSharp.Stdio.Host, Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpWorkspaceOptionsProvider
[22:46:23] INFORMATION: OmniSharp.Stdio.Host, Configuration finished.
[22:46:23] INFORMATION: OmniSharp.Stdio.Host, Omnisharp server running using Stdio at location '/Users/{user}/temp' on host -1.
[22:46:26] <-- 81 /codecheck: ((QuickFixes . []))
[22:46:26] <-- 82 /codecheck: ((QuickFixes . []))
[22:46:29] <-- 83 /codecheck: ((QuickFixes . []))
[22:46:29] <-- 85 /typelookup: ((Type) (Documentation))
[22:46:29] <-- 84 /autocomplete: []
[22:46:29] <-- 86 /codecheck: ((QuickFixes . []))
[22:46:34] <-- 87 /autocomplete: []
[22:46:35] <-- 88 /codecheck: ((QuickFixes . []))

Why didn't Omnisharp load my brand-new project file?

I did the same steps on macOS, and it did work for me..

[08:26:03] Starting OmniSharpServer using project folder/solution file: /Users/bob/tmp/emacs/temp/temp.sln
[08:26:03] Using server binary on /Users/bob/.emacs.d/.cache/omnisharp/server/v1.26.3/run
[08:26:04] INFORMATION: OmniSharp.Stdio.Host, Starting OmniSharp on MacOS 10.13.3 (x64)
[08:26:04] INFORMATION: OmniSharp.MSBuild.Discovery.MSBuildLocator, Located 1 MSBuild instance(s)
            1: StandAlone 15.0 - "/Users/bob/.emacs.d/.cache/omnisharp/server/v1.26.3/omnisharp/msbuild/15.0/Bin"
[08:26:04] INFORMATION: OmniSharp.MSBuild.Discovery.MSBuildLocator, MSBUILD_EXE_PATH environment variable set to '/Users/bob/.emacs.d/.cache/omnisharp/server/v1.26.3/omnisharp/msbuild/15.0/Bin/MSBuild.dll'
[08:26:04] INFORMATION: OmniSharp.MSBuild.Discovery.MSBuildLocator, Registered MSBuild instance: StandAlone 15.0 - "/Users/bob/.emacs.d/.cache/omnisharp/server/v1.26.3/omnisharp/msbuild/15.0/Bin"
            MSBuildExtensionsPath = /Library/Frameworks/Mono.framework/Versions/5.10.0/lib/mono/xbuild
            CscToolPath = /Users/bob/.emacs.d/.cache/omnisharp/server/v1.26.3/omnisharp/msbuild/15.0/Bin/Roslyn
            CscToolExe = csc.exe
            MSBuildToolsPath = /Users/bob/.emacs.d/.cache/omnisharp/server/v1.26.3/omnisharp/msbuild/15.0/Bin
            TargetFrameworkRootPath = /Library/Frameworks/Mono.framework/Versions/5.10.0/lib/mono/xbuild-frameworks
[08:26:05] INFORMATION: OmniSharp.Cake.CakeProjectSystem, Detecting Cake files in '/Users/bob/tmp/emacs/temp'.
[08:26:05] INFORMATION: OmniSharp.Cake.CakeProjectSystem, Could not find any Cake files
[08:26:05] INFORMATION: OmniSharp.DotNet.DotNetProjectSystem, Initializing in /Users/bob/tmp/emacs/temp
[08:26:05] INFORMATION: OmniSharp.DotNet.DotNetProjectSystem, Auto package restore: False
[08:26:05] INFORMATION: OmniSharp.DotNet.DotNetProjectSystem, Update workspace context
[08:26:05] INFORMATION: OmniSharp.DotNet.DotNetProjectSystem, Resolving projects references
[08:26:05] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Detecting projects in '/Users/bob/tmp/emacs/temp/temp.sln'.
[08:26:05] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /Users/bob/tmp/emacs/temp/temp.csproj
[08:26:08] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Update project: temp
[08:26:08] INFORMATION: OmniSharp.Script.ScriptProjectSystem, Detecting CSX files in '/Users/bob/tmp/emacs/temp'.
[08:26:08] INFORMATION: OmniSharp.Script.ScriptProjectSystem, Could not find any CSX files
[08:26:08] INFORMATION: OmniSharp.Stdio.Host, Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpWorkspaceOptionsProvider
[08:26:08] INFORMATION: OmniSharp.Stdio.Host, Configuration finished.
[08:26:08] INFORMATION: OmniSharp.Stdio.Host, Omnisharp server running using Stdio at location '/Users/bob/tmp/emacs/temp' on host -1.
[08:26:09] <-- 1867 /currentfilemembersasflat: [((FileName) (Line . 5) (Column . 11) (EndLine . 5) (EndColumn . 18) (Text . "Program") (Projects . [])) ((FileName) (Line . 7) (Column . 21) (EndLine . 7) (EndColumn . 25) (Text . "Main") (Projects . []))]
[08:26:10] <-- 1866 /codecheck: ((QuickFixes . []))
[08:26:11] <-- 1868 /typelookup: ((Type) (Documentation))

Does the .csproj file still actually exists there on the path in .sln?

Could you try using a later server version, just in case they provide more diagnostic information on the log (by changing the omnisharp-expected-server-version) variable and invoking M-x omnisharp-install-server?

I set omnisharp-expected-server-version to "1.29.1" (the latest release), and got the same result.

[11:11:38] Starting OmniSharpServer using project folder/solution file: /Users/doomchild/temp/
[11:11:38] Using server binary on /Users/doomchild/.emacs.d/.cache/omnisharp/server/v1.29.1/run
[11:11:39] INFORMATION: OmniSharp.Stdio.Host, Starting OmniSharp on MacOS 10.13.3 (x64)
[11:11:39] INFORMATION: OmniSharp.MSBuild.Discovery.MSBuildLocator, Located 1 MSBuild instance(s)
            1: StandAlone 15.0 - "/Users/doomchild/.emacs.d/.cache/omnisharp/server/v1.29.1/omnisharp/msbuild/15.0/Bin"
[11:11:39] INFORMATION: OmniSharp.MSBuild.Discovery.MSBuildLocator, MSBUILD_EXE_PATH environment variable set to '/Users/doomchild/.emacs.d/.cache/omnisharp/server/v1.29.1/omnisharp/msbuild/15.0/Bin/MSBuild.dll'
[11:11:39] INFORMATION: OmniSharp.MSBuild.Discovery.MSBuildLocator, Registered MSBuild instance: StandAlone 15.0 - "/Users/doomchild/.emacs.d/.cache/omnisharp/server/v1.29.1/omnisharp/msbuild/15.0/Bin"
            MSBuildExtensionsPath = /Users/doomchild/.emacs.d/.cache/omnisharp/server/v1.29.1/omnisharp/msbuild
            CscToolPath = /Users/doomchild/.emacs.d/.cache/omnisharp/server/v1.29.1/omnisharp/msbuild/15.0/Bin/Roslyn
            CscToolExe = csc.exe
            MSBuildToolsPath = /Users/doomchild/.emacs.d/.cache/omnisharp/server/v1.29.1/omnisharp/msbuild/15.0/Bin
[11:11:39] INFORMATION: OmniSharp.Cake.CakeProjectSystem, Detecting Cake files in '/Users/doomchild/temp/'.
[11:11:39] INFORMATION: OmniSharp.Cake.CakeProjectSystem, Could not find any Cake files
[11:11:39] INFORMATION: OmniSharp.DotNet.DotNetProjectSystem, Initializing in /Users/doomchild/temp/
[11:11:39] INFORMATION: OmniSharp.DotNet.DotNetProjectSystem, Auto package restore: False
[11:11:39] INFORMATION: OmniSharp.DotNet.DotNetProjectSystem, Update workspace context
[11:11:39] INFORMATION: OmniSharp.DotNet.DotNetProjectSystem, Resolving projects references
[11:11:39] INFORMATION: OmniSharp.MSBuild.ProjectSystem, Detecting projects in '/Users/doomchild/temp/temp.sln'.
[11:11:39] INFORMATION: OmniSharp.MSBuild.ProjectManager, Queue project update for '/Users/doomchild/temp/temp.csproj'
[11:11:39] INFORMATION: OmniSharp.Script.ScriptProjectSystem, Detecting CSX files in '/Users/doomchild/temp/'.
[11:11:39] INFORMATION: OmniSharp.Script.ScriptProjectSystem, Could not find any CSX files
[11:11:39] INFORMATION: OmniSharp.Stdio.Host, Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpWorkspaceOptionsProvider
[11:11:39] INFORMATION: OmniSharp.Stdio.Host, Configuration finished.
[11:11:39] INFORMATION: OmniSharp.Stdio.Host, Omnisharp server running using Stdio at location '/Users/doomchild/temp/' on host -1.
[11:11:39] INFORMATION: OmniSharp.MSBuild.ProjectManager, Loading project: /Users/doomchild/temp/temp.csproj
[11:11:39] WARNING: OmniSharp.MSBuild.ProjectManager, Failed to load project file '/Users/doomchild/temp/temp.csproj'.

The .csproj file is in the same directory as the solution file:

TMA-1:temp doomchild  λ ll
total 24
drwxr-xr-x    6 doomchild  staff   192 Mar 14 22:55 ./
drwxr-xr-x@ 143 doomchild  staff  4576 Mar 14 22:45 ../
-rw-r--r--    1 doomchild  staff   186 Mar 14 22:45 Program.cs
drwxr-xr-x    6 doomchild  staff   192 Mar 14 22:45 obj/
-rw-r--r--    1 doomchild  staff   178 Mar 14 22:45 temp.csproj
-rw-r--r--    1 doomchild  staff  1679 Mar 14 22:46 temp.sln

I haven't modified the .csproj file at all, and the only modification to the solution file was adding the .csproj to it (via dotnet sln add temp.csproj).

You probably want to register an issue in the https://github.com/OmniSharp/omnisharp-roslyn/ repository. Maintainers of the language server will now more about this..

Fair enough.

kpace commented

@doomchild Do you have any fix on this? Thanks!

I made an issue on the omnisharp-roslyn repo (OmniSharp/omnisharp-roslyn#1135). I haven't heard anything back yet.

Here are the sources. I created this using the above commands.
temp.zip

Hi,
I've got the same issue. I'm running Manjaro, latest dotnet core, latest mono, Omnisharp 1.26.3, Emacs 25.3.1

Actually I've just solved my problem by installing msbuild-stable 15.4_xamarinxplat.2017.11.27.11.23_0xamarin1_ubuntu1404b1-3 package.

I hope it helps.

@kirill-gerasimenko -- thanks, will add this to the README.txt/troubleshooting section

FWIW I was having the same issue, installing msbuild from Nixpkgs or mono-xbuild from Ubuntu did not help at all. Finally, it seems like upgrading OmniSharp-Roslyn to 1.34.13 ((setq omnisharp-expected-server-version "1.34.13")) fixed it.