OmniSharp / omnisharp-roslyn

OmniSharp server (HTTP, STDIO) based on Roslyn workspaces
MIT License
1.79k stars 419 forks source link

It looks like you have Mono installed which contains a MSBuild lower than 17.0.0 #2492

Open phromaj opened 1 year ago

phromaj commented 1 year ago

Hi, I'm trying to make the latest version of omnisharp work on Arch Linux but I stumbled against this error :

{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.Stdio.Host","Message":"Starting OmniSharp on arch 0.0 (x64)"},"Seq":1,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.Services.DotNetCliService","Message":"Checking the 'DOTNET_ROOT' environment variable to find a .NET SDK"},"Seq":2,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.Services.DotNetCliService","Message":"DotNetPath set to /home/lucas/.dotnet/dotnet"},"Seq":3,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.MSBuild.Discovery.MSBuildLocator","Message":"Located 1 MSBuild instance(s)\n            1: Mono 16.10.1 - \"/usr/lib/mono/msbuild/Current/bin\""},"Seq":4,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"WARNING","Name":"OmniSharp.CompositionHostBuilder","Message":"It looks like you have Mono installed which contains a MSBuild lower than 17.0.0 which is the minimum supported by the configured .NET Core Sdk.\n Try updating Mono to the latest stable or preview version to enable better .NET Core Sdk support."},"Seq":5,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.MSBuild.Discovery.MSBuildLocator","Message":"Registered MSBuild instance: Mono 16.10.1 - \"/usr/lib/mono/msbuild/Current/bin\""},"Seq":6,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.WorkspaceInitializer","Message":"Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0"},"Seq":7,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.Cake.CakeProjectSystem","Message":"Detecting Cake files in '/home/lucas/Code/prout'."},"Seq":8,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.Cake.CakeProjectSystem","Message":"Did not find any Cake files"},"Seq":9,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.MSBuild.ProjectSystem","Message":"No solution files found in '/home/lucas/Code/prout'"},"Seq":10,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.MSBuild.ProjectManager","Message":"Queue project update for '/home/lucas/Code/prout/prout.csproj'"},"Seq":11,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.Script.ScriptProjectSystem","Message":"Detecting CSX files in '/home/lucas/Code/prout'."},"Seq":12,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.Script.ScriptProjectSystem","Message":"Did not find any CSX files"},"Seq":13,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.WorkspaceInitializer","Message":"Configuration finished."},"Seq":14,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.Stdio.Host","Message":"Omnisharp server running using Stdio at location '/home/lucas/Code/prout' on host -1."},"Seq":15,"Type":"event"}
{"Event":"started","Body":null,"Seq":16,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.MSBuild.ProjectManager","Message":"Loading project: /home/lucas/Code/prout/prout.csproj"},"Seq":17,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"ERROR","Name":"OmniSharp.MSBuild.ProjectLoader","Message":"The reference assemblies for \".NETFramework,Version=v6.0\" were not found. You might be using an older .NET SDK to target .NET 5.0 or higher. Update Visual Studio and/or your .NET SDK."},"Seq":18,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"WARNING","Name":"OmniSharp.MSBuild.ProjectManager","Message":"Failed to load project file '/home/lucas/Code/prout/prout.csproj'."},"Seq":19,"Type":"event"}
{"Event":"MsBuildProjectDiagnostics","Body":{"FileName":"/home/lucas/Code/prout/prout.csproj","Warnings":[],"Errors":[{"LogLevel":"Error","FileName":"/usr/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets","Text":"The reference assemblies for \".NETFramework,Version=v6.0\" were not found. You might be using an older .NET SDK to target .NET 5.0 or higher. Update Visual Studio and/or your .NET SDK.","StartLine":1232,"StartColumn":5,"EndLine":0,"EndColumn":0}]},"Seq":20,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"ERROR","Name":"OmniSharp.MSBuild.ProjectManager","Message":"Attempted to update project that is not loaded: /home/lucas/Code/prout/prout.csproj"},"Seq":21,"Type":"event"}

Here's my dotnet --info :

.NET SDK (reflecting any global.json):
 Version:   6.0.404
 Commit:    be4f3ec411

Runtime Environment:
 OS Name:     arch
 OS Version:  
 OS Platform: Linux
 RID:         arch-x64
 Base Path:   /home/lucas/.dotnet/sdk/6.0.404/

Host:
  Version:      7.0.1
  Architecture: x64
  Commit:       97203d38ba

.NET SDKs installed:
  6.0.404 [/home/lucas/.dotnet/sdk]
  7.0.101 [/home/lucas/.dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.12 [/home/lucas/.dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.1 [/home/lucas/.dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.12 [/home/lucas/.dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.1 [/home/lucas/.dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  DOTNET_ROOT       [/home/lucas/.dotnet/]

global.json file:
  /home/lucas/Code/prout/global.json

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

Does anyone have an idea?

Thank you.

filipw commented 1 year ago

There is currently no Mono distribution that ships with MSBuild 17.0.0 so running OmniSharp with Mono does not support .NET 6.0.

For .NET 6.0 you need to use the .NET 6.0 distribution of OmniSharp https://github.com/OmniSharp/omnisharp-roslyn/releases/tag/v1.39.3

phromaj commented 1 year ago

Hi, thanks for your response but I'm using this version already.

filipw commented 1 year ago

I do not mean just version 1.39.3. Version 1.39.3 comes in a Mono flavour and in .NET 6.0 flavour (see the files attached to the release).

If you launch .NET 6.0 build of OmniSharp (with .NET SDK not with Mono) it should not have Mono MSBuild locator enabled, so it should not discover Mono at all (which in your case happens).