Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Omnisharp not properly handling default dot net core 3 app in vscode

Omnisharp is showing errors and vscode keeps popping up:

"there are unresolved dependencies"

When I create a standard .Net 3 mvc app. I can run dotnet restore and it works properly.

dotnet new mvc


I've installed the dot net core 3 SDK.

dotnet --list-sdks
2.2.102 [C:\Program Files\dotnet\sdk]
3.0.100 [C:\Program Files\dotnet\sdk]


default csproj file

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp3.0</TargetFramework>
  </PropertyGroup>


  <ItemGroup>
  </ItemGroup>

</Project>


The MSBuildSDKsPath path is proper:

C:\Program Files\dotnet\sdk\3.0.100\Sdks


The project builds and runs properly, but omnisharp is not working:

enter image description here

The last lines in the Omnisharp Output:

[warn]: OmniSharp.MSBuild.PackageDependencyChecker
        30temp: Did not find 'Microsoft.NETCore.App' in lock file.


Any ideas?

Edit: After uninstalling the 2.2.102 SDK, it seems to have fixed the problem.

So the question changes to: Why does having 2 sdks installed confuse Omnisharp?


like image 533
R. StackUser Avatar asked Sep 24 '19 20:09

R. StackUser


People also ask

Does Visual Studio use OmniSharp?

C# for Visual Studio Code (powered by OmniSharp) This extension provides the following features inside VS Code: Lightweight development tools for . NET Core. Great C# editing support, including Syntax Highlighting, IntelliSense, Go to Definition, Find All References, etc.

What is OmniSharp in Vscode?

OmniSharp is a set of tooling, editor integrations and libraries that together create an ecosystem that allows you to have a great programming experience no matter what your editor and operating system of choice may be.

Does VS code support .NET core?

Visual Studio Code lets you write ASP.NET Core applications by leveraging all of the evolved editing features available to C# and to the other file types in the project. Being a cross-platform itself, it's the perfect companion to start writing MVC applications for Linux, OS X and Windows.


1 Answers

This is the link to another user that is having the same issue and reported it to the omnisharp git repo: https://github.com/OmniSharp/omnisharp-vscode/issues/3290

It seems very active with a few work around suggestions. Hopefully a proper fix will be out soon. I am also having the same problem.

like image 85
Matthew Turner Avatar answered Oct 21 '22 13:10

Matthew Turner