Closed gukz closed 4 years ago
OmniSharp (and C# generally) works on projects and solutions. :OmniSharpGotoDefinition
will find all definitions in all C# files in the solution/project.
When I open a .cs file, the Omnisharp-vim keeps show `The specified SDK version ''3.1.*'' could not be parsed', then follows Failed to load project: xxxxx, here is my environment message, can someone know how to fix it?
$ dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 3.1.403
Commit: 9e895200cd
Runtime Environment:
OS Name: ubuntu
OS Version: 20.04
OS Platform: Linux
RID: ubuntu.20.04-x64
Base Path: /usr/share/dotnet/sdk/3.1.403/
Host (useful for support):
Version: 3.1.9
Commit: 774fc3d6a9
.NET Core SDKs installed:
2.1.811 [/usr/share/dotnet/sdk]
3.1.403 [/usr/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.23 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.23 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.9 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.23 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.9 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
$ dotnet --list-sdks
2.1.811 [/usr/share/dotnet/sdk]
3.1.403 [/usr/share/dotnet/sdk]
$ dotnet --list-runtimes
Microsoft.AspNetCore.All 2.1.23 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.23 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.9 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.23 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.9 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Can you show your log? :OmniSharpOpenLog
Just to chime in a little bit here (for others who may have this same issue and end up here, which is not the one the OP has), I have seen this happen if you are trying to go to definition on something that is not in the loaded solution. So for instance you may have this setup:
aqez@aqez-laptop:~/solid$ tree
.
├── SomeProject
│ ├── Program.cs
│ ├── SomeProject.csproj
│ ├── Yep.cs
│ └── Nope.cs
└── SomeSolution.sln
However, if SomeProject.csproj is not included in SomeSolution.sln, then :OmniSharpGoToDefinition
will not work (which is correct behavior) unless you manually open the files that have those definitions, then once they are in buffers it will work correctly.
NVIM v0.4.4
OmniSharp server started. Path: /home/gukz/.cache/omnisharp-vim/omnisharp-roslyn/OmniSharp.exe Target: /mnt/c/dev/ms/MyProject/Project.sln PID: 2689
Starting OmniSharp on ubuntu 20.4 (x64)
DotNetPath set to dotnet
Located 2 MSBuild instance(s)
1: Mono 16.8.0 - "/usr/lib/mono/msbuild/Current/bin"
2: StandAlone 16.8.0 - "/home/gukz/.cache/omnisharp-vim/omnisharp-roslyn/.msbuild/Current/Bin"
Registered MSBuild instance: Mono 16.8.0 - "/usr/lib/mono/msbuild/Current/bin"
CscToolExe = csc.exe
CscToolPath = /home/gukz/.cache/omnisharp-vim/omnisharp-roslyn/.msbuild/Current/Bin/Roslyn
Detecting Cake files in '/mnt/c/dev/ms/MyProject'.
Could not find any Cake files
Detecting projects in '/mnt/c/dev/ms/MyProject/Project.sln'.
Queue project update for '/mnt/c/dev/ms/MyProject/src/Project.Api/Project.API.csproj'
Queue project update for '/mnt/c/dev/ms/MyProject/src/Project.Functions/Project.Functions.csproj'
Queue project update for '/mnt/c/dev/ms/MyProject/src/Project.Core/Project.Core.csproj'
Queue project update for '/mnt/c/dev/ms/MyProject/src/UnitTests/Project.Core.UnitTests/Project.Core.UnitTests.csproj'
Queue project update for '/mnt/c/dev/ms/MyProject/src/Project.Client/Project.Client.csproj'
Queue project update for '/mnt/c/dev/ms/MyProject/src/Project.Abstractions/Project.Abstractions.csproj'
Queue project update for '/mnt/c/dev/ms/MyProject/src/Tools/ClientTestApp/ClientTestApp.csproj'
Queue project update for '/mnt/c/dev/ms/MyProject/src/Ev2ArtifactsGenerator/Ev2ArtifactsGenerator.csproj'
Queue project update for '/mnt/c/dev/ms/MyProject/src/Project.Validation/Project.Validation.csproj'
Queue project update for '/mnt/c/dev/ms/MyProject/src/UnitTests/Project.Validation.UnitTests/Project.Validation.UnitTests.csproj'
Queue project update for '/mnt/c/dev/ms/MyProject/src/UnitTests/Project.API.UnitTests/Project.API.UnitTests.csproj'
Queue project update for '/mnt/c/dev/ms/MyProject/src/UnitTests/Project.UnitTests.Common/Project.UnitTests.Common.csproj'
Queue project update for '/mnt/c/dev/ms/MyProject/src/UnitTests/Project.Abstractions.UnitTests/Project.Abstractions.UnitTests.csproj'
Detecting CSX files in '/mnt/c/dev/ms/MyProject'.
Loading project: /mnt/c/dev/ms/MyProject/src/Project.Api/Project.API.csproj
Could not find any CSX files
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.Completion.CompletionOptionsProvider, Order: 0
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider, Order: 100
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.ImplementTypeWorkspaceOptionsProvider, Order: 110
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.BlockStructureWorkspaceOptionsProvider, Order: 140
Configuration finished.
Omnisharp server running using Stdio at location '/mnt/c/dev/ms/MyProject' on host -1.
Package Microsoft.Azure.WebJobs.Extensions.DurableTask.Analyzers, version 0.2.3 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions.
Failed to load project file '/mnt/c/dev/ms/MyProject/src/Project.Api/Project.API.csproj'.
/mnt/c/dev/ms/MyProject/src/Project.Api/Project.API.csproj /usr/lib/mono/msbuild/Current/bin/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(234,5): Error: Package Microsoft.Azure.WebJobs.Extensions.DurableTask.Analyzers, version 0.2.3 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions.
Loading project: /mnt/c/dev/ms/MyProject/src/Project.Functions/Project.Functions.csproj
Package Microsoft.Azure.WebJobs.Extensions.DurableTask.Analyzers, version 0.2.3 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions.
Failed to load project file '/mnt/c/dev/ms/MyProject/src/Project.Functions/Project.Functions.csproj'.
/mnt/c/dev/ms/MyProject/src/Project.Functions/Project.Functions.csproj /usr/lib/mono/msbuild/Current/bin/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(234,5): Error: Package Microsoft.Azure.WebJobs.Extensions.DurableTask.Analyzers, version 0.2.3 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions.
Loading project: /mnt/c/dev/ms/MyProject/src/Project.Core/Project.Core.csproj
Package Microsoft.Azure.WebJobs.Extensions.DurableTask.Analyzers, version 0.2.3 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions.
Failed to load project file '/mnt/c/dev/ms/MyProject/src/Project.Core/Project.Core.csproj'.
/mnt/c/dev/ms/MyProject/src/Project.Core/Project.Core.csproj /usr/lib/mono/msbuild/Current/bin/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(234,5): Error: Package Microsoft.Azure.WebJobs.Extensions.DurableTask.Analyzers, version 0.2.3 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions.
Loading project: /mnt/c/dev/ms/MyProject/src/UnitTests/Project.Core.UnitTests/Project.Core.UnitTests.csproj
Package Microsoft.Azure.WebJobs.Extensions.DurableTask.Analyzers, version 0.2.3 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions.
Failed to load project file '/mnt/c/dev/ms/MyProject/src/UnitTests/Project.Core.UnitTests/Project.Core.UnitTests.csproj'.
/mnt/c/dev/ms/MyProject/src/UnitTests/Project.Core.UnitTests/Project.Core.UnitTests.csproj /usr/lib/mono/msbuild/Current/bin/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(234,5): Error: Package Microsoft.Azure.WebJobs.Extensions.DurableTask.Analyzers, version 0.2.3 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions.
Loading project: /mnt/c/dev/ms/MyProject/src/Project.Client/Project.Client.csproj
Package Microsoft.Azure.WebJobs.Extensions.DurableTask.Analyzers, version 0.2.3 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions.
Failed to load project file '/mnt/c/dev/ms/MyProject/src/Project.Client/Project.Client.csproj'.
/mnt/c/dev/ms/MyProject/src/Project.Client/Project.Client.csproj /usr/lib/mono/msbuild/Current/bin/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(234,5): Error: Package Microsoft.Azure.WebJobs.Extensions.DurableTask.Analyzers, version 0.2.3 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions.
Loading project: /mnt/c/dev/ms/MyProject/src/Project.Abstractions/Project.Abstractions.csproj
Package Roslynator.Analyzers, version 3.0.0 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions.
Failed to load project file '/mnt/c/dev/ms/MyProject/src/Project.Abstractions/Project.Abstractions.csproj'.
/mnt/c/dev/ms/MyProject/src/Project.Abstractions/Project.Abstractions.csproj /usr/lib/mono/msbuild/Current/bin/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(234,5): Error: Package Roslynator.Analyzers, version 3.0.0 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions.
Loading project: /mnt/c/dev/ms/MyProject/src/Tools/ClientTestApp/ClientTestApp.csproj
Package Microsoft.Azure.WebJobs.Extensions.DurableTask.Analyzers, version 0.2.3 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions.
Failed to load project file '/mnt/c/dev/ms/MyProject/src/Tools/ClientTestApp/ClientTestApp.csproj'.
/mnt/c/dev/ms/MyProject/src/Tools/ClientTestApp/ClientTestApp.csproj /usr/lib/mono/msbuild/Current/bin/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(234,5): Error: Package Microsoft.Azure.WebJobs.Extensions.DurableTask.Analyzers, version 0.2.3 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions.
Loading project: /mnt/c/dev/ms/MyProject/src/Ev2ArtifactsGenerator/Ev2ArtifactsGenerator.csproj
Package Roslynator.Analyzers, version 3.0.0 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions.
Failed to load project file '/mnt/c/dev/ms/MyProject/src/Ev2ArtifactsGenerator/Ev2ArtifactsGenerator.csproj'.
/mnt/c/dev/ms/MyProject/src/Ev2ArtifactsGenerator/Ev2ArtifactsGenerator.csproj /usr/lib/mono/msbuild/Current/bin/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(234,5): Error: Package Roslynator.Analyzers, version 3.0.0 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions.
Loading project: /mnt/c/dev/ms/MyProject/src/Project.Validation/Project.Validation.csproj
Package Microsoft.Azure.WebJobs.Extensions.DurableTask.Analyzers, version 0.2.3 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions.
Failed to load project file '/mnt/c/dev/ms/MyProject/src/Project.Validation/Project.Validation.csproj'.
/mnt/c/dev/ms/MyProject/src/Project.Validation/Project.Validation.csproj /usr/lib/mono/msbuild/Current/bin/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(234,5): Error: Package Microsoft.Azure.WebJobs.Extensions.DurableTask.Analyzers, version 0.2.3 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions.
Loading project: /mnt/c/dev/ms/MyProject/src/UnitTests/Project.Validation.UnitTests/Project.Validation.UnitTests.csproj
Package Microsoft.Azure.WebJobs.Extensions.DurableTask.Analyzers, version 0.2.3 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions.
Failed to load project file '/mnt/c/dev/ms/MyProject/src/UnitTests/Project.Validation.UnitTests/Project.Validation.UnitTests.csproj'.
/mnt/c/dev/ms/MyProject/src/UnitTests/Project.Validation.UnitTests/Project.Validation.UnitTests.csproj /usr/lib/mono/msbuild/Current/bin/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(234,5): Error: Package Microsoft.Azure.WebJobs.Extensions.DurableTask.Analyzers, version 0.2.3 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions.
Loading project: /mnt/c/dev/ms/MyProject/src/UnitTests/Project.API.UnitTests/Project.API.UnitTests.csproj
Package Microsoft.Azure.WebJobs.Extensions.DurableTask.Analyzers, version 0.2.3 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions.
Failed to load project file '/mnt/c/dev/ms/MyProject/src/UnitTests/Project.API.UnitTests/Project.API.UnitTests.csproj'.
/mnt/c/dev/ms/MyProject/src/UnitTests/Project.API.UnitTests/Project.API.UnitTests.csproj /usr/lib/mono/msbuild/Current/bin/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(234,5): Error: Package Microsoft.Azure.WebJobs.Extensions.DurableTask.Analyzers, version 0.2.3 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions.
Loading project: /mnt/c/dev/ms/MyProject/src/UnitTests/Project.UnitTests.Common/Project.UnitTests.Common.csproj
Package Microsoft.Azure.WebJobs.Extensions.DurableTask.Analyzers, version 0.2.3 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions.
Failed to load project file '/mnt/c/dev/ms/MyProject/src/UnitTests/Project.UnitTests.Common/Project.UnitTests.Common.csproj'.
/mnt/c/dev/ms/MyProject/src/UnitTests/Project.UnitTests.Common/Project.UnitTests.Common.csproj /usr/lib/mono/msbuild/Current/bin/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(234,5): Error: Package Microsoft.Azure.WebJobs.Extensions.DurableTask.Analyzers, version 0.2.3 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions.
Loading project: /mnt/c/dev/ms/MyProject/src/UnitTests/Project.Abstractions.UnitTests/Project.Abstractions.UnitTests.csproj
Package Roslynator.Analyzers, version 3.0.0 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions.
Failed to load project file '/mnt/c/dev/ms/MyProject/src/UnitTests/Project.Abstractions.UnitTests/Project.Abstractions.UnitTests.csproj'.
All projects loaded /mnt/c/dev/ms/MyProject/src/UnitTests/Project.Abstractions.UnitTests/Project.Abstractions.UnitTests.csproj /usr/lib/mono/msbuild/Current/bin/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(234,5): Error: Package Roslynator.Analyzers, version 3.0.0 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions.
Attempted to update project that is not loaded: /mnt/c/dev/ms/MyProject/src/Project.Api/Project.API.csproj
Attempted to update project that is not loaded: /mnt/c/dev/ms/MyProject/src/Project.Functions/Project.Functions.csproj
Attempted to update project that is not loaded: /mnt/c/dev/ms/MyProject/src/Project.Core/Project.Core.csproj
Attempted to update project that is not loaded: /mnt/c/dev/ms/MyProject/src/UnitTests/Project.Core.UnitTests/Project.Core.UnitTests.csproj
Attempted to update project that is not loaded: /mnt/c/dev/ms/MyProject/src/Project.Client/Project.Client.csproj
Attempted to update project that is not loaded: /mnt/c/dev/ms/MyProject/src/Project.Abstractions/Project.Abstractions.csproj
Attempted to update project that is not loaded: /mnt/c/dev/ms/MyProject/src/Tools/ClientTestApp/ClientTestApp.csproj
Attempted to update project that is not loaded: /mnt/c/dev/ms/MyProject/src/Ev2ArtifactsGenerator/Ev2ArtifactsGenerator.csproj
Attempted to update project that is not loaded: /mnt/c/dev/ms/MyProject/src/Project.Validation/Project.Validation.csproj
Attempted to update project that is not loaded: /mnt/c/dev/ms/MyProject/src/UnitTests/Project.Validation.UnitTests/Project.Validation.UnitTests.csproj
Attempted to update project that is not loaded: /mnt/c/dev/ms/MyProject/src/UnitTests/Project.API.UnitTests/Project.API.UnitTests.csproj
Attempted to update project that is not loaded: /mnt/c/dev/ms/MyProject/src/UnitTests/Project.UnitTests.Common/Project.UnitTests.Common.csproj
Attempted to update project that is not loaded: /mnt/c/dev/ms/MyProject/src/UnitTests/Project.Abstractions.UnitTests/Project.Abstractions.UnitTests.csproj
Workspace complete: 13 project(s) Replaying on-load requests
Miscellaneous file: /mnt/c/dev/ms/MyProject/src/Project.API/Controllers/Internal/ComputeController.cs added to workspace
Replaying requests for buffer 8
Package Microsoft.Azure.WebJobs.Extensions.DurableTask.Analyzers, version 0.2.3 was not found. It might have been deleted since NuGet restore
As you can see from the log, all your projects are failing to load. There are apparently some references in your targets file which are missing on your system.
When I open a .cs file, the Omnisharp-vim keeps show `The specified SDK version ''3.1.*'' could not be parsed',
How and where is OmniSharp-vim displaying this?
When I open a .cs file, the Omnisharp-vim keeps show `The specified SDK version ''3.1.*'' could not be parsed',
How and where is OmniSharp-vim displaying this?
stderr: ['The specified SDK version ''3.1.'' could not be parsed', 'A compatible installed dotnet SDK for global.json version: [3.1.] from [/mnt/c/dev/ms/MyProject/global.json] was not found', 'Please install the [3.1.*] SDK or update [/mnt/c/dev/ms/MyProject/global.json] with an installed dotnet SDK:', ' I t was not possible to find any installed dotnet SDKs', ' Did you mean to run dotnet SDK commands? Please insta ll dotnet SDK from:', ' https://aka.ms/dotnet-download', ''] Press ENTER or type command to continue
When I open the first *.cs file, this displayed at the bottom of neovim.
OK, I just want a way to scan all *.cs files to use fine gotoDefinition
, I do not hope the OmniSharp can read my project correctly. I try to open all files in buffer by :argadd **/*.cs
, after this command finished all the *.cs file is in buffers, but only after I open each cs file I can gotoDefinition
, is there some way to do this automatially?
Ok. Well the problem is your dotnet environment. If you can't manage to fix it yourself, I'd recommend opening an issue with OmniSharp-roslyn with your log contents.
Unless @filipw might be able to have a peek here, and give any advice based on your log posted above?
@gukz if you really don't care about getting your server working correctly, try something like :argdo e
after your :argadd
command
:argdo e
works, but I hope we can keep this issue open for some days to see if someone can fix it. This .Net Core Solutions
works fine in Visual Studio (Windows), while OmniSharp-vim
cannot handle it smoothly for now.
It's not an OmniSharp-vim issue, there is nothing to fix in this project, which is simply the client for the OmniSharp-roslyn server. Please open an issue in the OmniSharp-roslyn project.
In Windows you also have a very different environment, with different dependencies available.
Since you are apparently working in WSL, I recommend you use OmniSharp-vim in WSL mode, where OmniSharp-vim will use a Windows build of OmniSharp-roslyn, and can then use your Windows environment and dependencies (even though Vim and OmniSharp-vim are still functioning on the Linux side of your system).
https://github.com/OmniSharp/omnisharp-vim#windows-subsystem-for-linux-wsl
I found the
go to definition
only works for my opened files, for those not opened*.cs
files, I cannotgo to definition
, so I have write some vim script to open all*.cs
files when I open the vim, right?