Omnisharp error about dotnet version - Unity

Viewed 2276

at VSCode launch today I'm receiving this error:

Starting OmniSharp server at 27/5/2022, 12:37:25
    Target: f:\UnityProjects\MyGame.sln
[ERROR] Error: Found dotnet version 5.0.407. Minimum required version is 6.0.100.

I read that there have been updates in omnisharp but I really don't know how to fix the issue. I've installed dotnet 6.0 TLS through a new visual studio installation... is there anything else I can do to bring dotnet working with my Unity project?

2 Answers

If you're using C# extension 1.25.0 they announced a change in the extension's details page:

.NET Framework builds of OmniSharp no longer ship with Mono or the MSBuild tooling (See announcement omnisharp-roslyn#2339). To ensure that the C# extension remains usable out of the box for .NET SDK projects, we have changed the default value of omnisharp.useModernNet to true.

If you still need Unity or .NET Framework support, you can set omnisharp.useModernNet to false in your VS Code settings and restart OmniSharp.

Changing that omnisharp.useModernNet setting to false worked for me.

If you use vscode for web development and your installed dotnet SDK version is < 6, this answer might be useful.

After quite some time I spotted an Ominisharp Log warning this.

[ERROR] Error: Found dotnet version 3.1.419. Minimum required version is 6.0.100.

Solution

Install dotnet SDK 6 alongside or by replacing your current version.

I recommend you install it by using the dotnet-install.{sh | ps1} script.

By running the command below it will install the latest version alongside your current one.

sudo ./dotnet-install.sh -c 6.0 --install-dir /usr/share/dotnet

~ » dotnet --list-sdks                                                                                                       
3.1.419 [/usr/share/dotnet/sdk]
6.0.300 [/usr/share/dotnet/sdk]

Related