28

I use VS Code as my IDE. Today I saw in my C# files that I could no longer use things like "Go To Definition/Implementations" or hover over anything to get the path/type etc.

I found my Omnisharp console and saw they updated last night and there is an error:

Error: Found dotnet version 5.0.201. Minimum required version is 6.0.100.

I can't upgrade my dotnet because 6.0 is not compatible with the runtime in my project and on Mac M1, there are a lot of issues running multiple dotnet instances..

I guess its a bit of a rock and a hard place, anyone know how I can get around this issue?

zeroG
  • 320
  • 2
  • 12
MambaForever
  • 359
  • 3
  • 11

5 Answers5

36

This is a recent update to Omnisharp, which is used by the VS Code C# extension. Add this to your settings and restart the editor.

    "omnisharp.useModernNet": false,
    "omnisharp.path": "",

Also if you don't have Visual Studio installed you will likely need to install the Build Tools to get MSBuild: enter image description here

My understanding of the rationale behind this change is an optimization for modern vanilla c# projects over those using older versions (ie Unity). More info in this issue.

chantey
  • 4,252
  • 1
  • 35
  • 40
  • 5
    This should really be an accepted answer since it clearly points out the solution + background info to it. – Grimm May 27 '22 at 13:49
  • @Grimm I think for those who don't have VS2022(?) installed, this doesn't actually work either. Doesn't work for me. I don't have rights to install build tools and I need to do some work ;-) – PandaWood Jun 13 '22 at 04:12
  • @PandaWood Are you sure that there isn't another problem? The above mentioned error is in the Omnisharp VS Code C# extension ... I don't think that this belongs to VS too. – Grimm Jun 13 '22 at 18:04
  • @Grimm Yeah no this is it. I have VS2019v16.3 installed (which is pre .NET5) and I'm working on .NET5 projects with VSCode. This already gets a warning with omnisharp and requires some special config. But when o# v1.25 came out, I suddenly couldn't do anything - with the same error as OP. Rolling back omnisharp to 1.24 works – PandaWood Jun 14 '22 at 11:56
29

Revert your Omnisharp to previous version

enter image description here

CSharp
  • 1,573
  • 2
  • 14
  • 25
  • 3
    geez! Why would someone force me to mess with this? It was working just fine until this last update. Thank you! Your answer helped me a lot. – Devilhunter May 29 '22 at 15:55
5

Update 1.25.0 introduces newer OmniSharp build for .NET 6 which does not support non SDK style .NET projects but results in performance improvements. Fortunately you can disable this in the settings:

C# Extension Settings

Also, the C# extension no longer ships with an included Mono & MSBuild Tools. Download them here: Build Tools Worst case, you can revert to an older extension version.

Shivam Baghel
  • 121
  • 1
  • 5
5
  1. Go to extensions in VS Code and search for C# Extension

VS Code Extensions

  1. Go to C# Extension settings

C# Extension Settings

  1. Disable "Use Modern Net" option.

Modern Net Option

  1. Restart VS Code
1

I haved similar problem and i fixed like this:

Im using win7 and i have VS 2019 IDE which not supporting dotnet 6 cuz of that vs_installer not installing dotnet6 sdk, in result i cant use c# extension v1.25.0 in vs code, because omnisharp needs net6. I installed net 6 sdk to my win7 and problem is solved, now i can use c# extension v1.25.0 in vs code.

zeroG
  • 320
  • 2
  • 12