Omnisharp-vscode: The "GetReferenceNearestTargetFrameworkTask" task was not found in omnisharp 1.32.16 (latest)

Created on 11 Apr 2019  路  7Comments  路  Source: OmniSharp/omnisharp-vscode

Environment data

NET Core SDK (reflecting any global.json):
 Version:   3.0.100-preview3-010431
 Commit:    d72abce213

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.17763
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\3.0.100-preview3-010431\

Host (useful for support):
  Version: 3.0.0-preview3-27503-5
  Commit:  3844df9537

.NET Core SDKs installed:
  3.0.100-preview3-010431 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.0.0-preview3-19153-02 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.0.0-preview3-27503-5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.0.0-preview3-27504-2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

VS Code version:

Version: 1.33.1 (user setup)
Commit: 51b0b28134d51361cf996d2f0a1c698247aeabd8
Date: 2019-04-11T08:27:14.102Z
Electron: 3.1.6
Chrome: 66.0.3359.181
Node.js: 10.2.0
V8: 6.6.346.32
OS: Windows_NT x64 10.0.17763

C# Extension version:

1.18.0

Steps to reproduce

Load a solution contain 2 project, let call them A and B which B has A as dependency.

Expected behavior

Both project are loaded.

Actual behavior

A load corectly but B cannot be load with error :

[fail]: OmniSharp.MSBuild.ProjectLoader
The "GetReferenceNearestTargetFrameworkTask" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with in the project file, or in the *.tasks files located in the "C:\Users\Komi-San-Supporter.vscode\extensions\ms-vscode.csharp-1.18.0.omnisharp\1.32.16\msbuild\Current\Bin" directory.

Additional information:

Log file (level debug):
omni.log

Despite not installing Visual Studio, the log said:

[dbug]: OmniSharp.MSBuild.ProjectSystem
MSBuild environment:
Mode: VisualStudio
RunningTests: False
RunningInVisualStudio: False

In older version, it was Mode: Standalone

I downgrade omnisharp to version 1.32.12-beta.51 and everything work as expected

Most helpful comment

@Fubuchi Can you set "omnisharp.path":'latest" in your VS Code settings? I believe this is fixed now.

All 7 comments

/cc @rchande

@Fubuchi We've trying to reproduce this, but are unable to. We're trying on Windows 10 + .NET Core Preview 3, and no Visual Studio installed. Does that match your configuration?

@rchande Yes, I also use "omnisharp.path": "latest"

Here is the solution I'm working on. The Functional.Tests have a dependency to Functional , if I remove the dependency, both projects can be loaded.

CSharpFunctional.zip

It looks like MSBuild change the heuristics it uses to determine if it's running in Visual Studio. Now, the omnisharp path for MSBuild matches one of the VS checks (https://github.com/Microsoft/msbuild/blob/master/src/Shared/BuildEnvironmentHelper.cs#L158) so MSBuild sets the VS mode, which results in weird behavior. I think we can work around this by changing the path omnisharp puts it under...

@Fubuchi Can you set "omnisharp.path":'latest" in your VS Code settings? I believe this is fixed now.

Yes, the issue is gone now. But the latest version is uh.. 3.5.0-beta.2210 while the nearest latest is 1.32.16. Is it a new branch? Just curious.

@Fubuchi No, it's a build issue where one of the CI builds is getting confused and generating incorrect version numbers. We're investigating.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jrmcdona picture jrmcdona  路  3Comments

mattwoberts picture mattwoberts  路  3Comments

slevengood picture slevengood  路  3Comments

visten picture visten  路  4Comments

olfek picture olfek  路  3Comments