question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

OmniSharp.MSBuild.ProjectLoader The "GetReferenceNearestTargetFrameworkTask" task was not found

See original GitHub issue

Environment data dotnet --info output:

Пакет SDK для .NET Core (отражающий любой global.json):
 Version:   2.1.401
 Commit:    91b1c13032

Среда выполнения:
 OS Name:     Windows
 OS Version:  6.1.7601
 OS Platform: Windows
 RID:         win7-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.1.401\

Host (useful for support):
  Version: 2.1.3
  Commit:  124038c13e

.NET Core SDKs installed:
  2.1.401 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

VS Code version: C# Extension version:

Версия: 1.27.1 (system setup) Фиксация: 5944e81f3c46a3938a82c701f96d7a59b074cfdc Дата: 2018-09-06T09:21:10.934Z Electron: 2.0.7 Chrome: 61.0.3163.100 Node.js: 8.9.3 V8: 6.1.534.41 Архитектура: ia32

Steps to reproduce after the last update Omni Sharp stopped working log:

Starting OmniSharp server at 9/11/2018, 2:03:34 PM
    Target: c:\Project\Test\Test.sln

OmniSharp server started.
    Path: C:\Users\borr\.vscode\extensions\ms-vscode.csharp-1.16.0\.omnisharp\1.32.4\OmniSharp.exe
    PID: 6744

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on Windows 6.1.7601.65536 (x64)
[info]: OmniSharp.Services.DotNetCliService
        DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 1 MSBuild instance(s)
            1: StandAlone 15.0 - "C:\Users\borr\.vscode\extensions\ms-vscode.csharp-1.16.0\.omnisharp\1.32.4\msbuild\15.0\Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        MSBUILD_EXE_PATH environment variable set to 'C:\Users\borr\.vscode\extensions\ms-vscode.csharp-1.16.0\.omnisharp\1.32.4\msbuild\15.0\Bin\MSBuild.exe'
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: StandAlone 15.0 - "C:\Users\borr\.vscode\extensions\ms-vscode.csharp-1.16.0\.omnisharp\1.32.4\msbuild\15.0\Bin"
            CscToolExe = csc.exe
            CscToolPath = C:\Users\borr\.vscode\extensions\ms-vscode.csharp-1.16.0\.omnisharp\1.32.4\msbuild\15.0\Bin\Roslyn
            MSBuildExtensionsPath = C:\Users\borr\.vscode\extensions\ms-vscode.csharp-1.16.0\.omnisharp\1.32.4\msbuild
            MSBuildToolsPath = C:\Users\borr\.vscode\extensions\ms-vscode.csharp-1.16.0\.omnisharp\1.32.4\msbuild\15.0\Bin
[info]: OmniSharp.Cake.CakeProjectSystem
        Detecting Cake files in 'c:\Project\Test'.
[info]: OmniSharp.Cake.CakeProjectSystem
        Could not find any Cake files
[info]: OmniSharp.Stdio.Host
        Project system 'OmniSharp.DotNet.DotNetProjectSystem' is disabled in the configuration.
[info]: OmniSharp.MSBuild.ProjectSystem
        Detecting projects in 'c:\Project\Test\Test.sln'.
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'c:\Project\Test\Assembly-CSharp.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'c:\Project\Test\Assembly-CSharp-firstpass.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'c:\Project\Test\Assembly-CSharp-Editor.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'c:\Project\Test\Assembly-CSharp-Editor-firstpass.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in 'c:\Project\Test'.
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: c:\Project\Test\Assembly-CSharp.csproj
[info]: OmniSharp.Script.ScriptProjectSystem
        Could not find any CSX files
[info]: OmniSharp.Stdio.Host
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpWorkspaceOptionsProvider
[info]: OmniSharp.Stdio.Host
        Configuration finished.
[info]: OmniSharp.Stdio.Host
        Omnisharp server running using Stdio at location 'c:\Project\Test' on host 5136.
[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 <UsingTask> in the project file, or in the *.tasks files located in the "C:\Users\borr\.vscode\extensions\ms-vscode.csharp-1.16.0\.omnisharp\1.32.4\msbuild\15.0\Bin" directory.
[warn]: OmniSharp.MSBuild.ProjectManager
        Failed to load project file 'c:\Project\Test\Assembly-CSharp.csproj'.
c:\Project\Test\Assembly-CSharp.csproj
C:\Users\borr\.vscode\extensions\ms-vscode.csharp-1.16.0\.omnisharp\1.32.4\msbuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(1657,5): Error: 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 <UsingTask> in the project file, or in the *.tasks files located in the "C:\Users\borr\.vscode\extensions\ms-vscode.csharp-1.16.0\.omnisharp\1.32.4\msbuild\15.0\Bin" directory.

[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: c:\Project\Test\Assembly-CSharp-firstpass.csproj
[info]: OmniSharp.MSBuild.ProjectManager
        Successfully loaded project file 'c:\Project\Test\Assembly-CSharp-firstpass.csproj'.
[info]: OmniSharp.MSBuild.ProjectManager
        Adding project 'c:\Project\Test\Assembly-CSharp-firstpass.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: c:\Project\Test\Assembly-CSharp-Editor.csproj
[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 <UsingTask> in the project file, or in the *.tasks files located in the "C:\Users\borr\.vscode\extensions\ms-vscode.csharp-1.16.0\.omnisharp\1.32.4\msbuild\15.0\Bin" directory.
[warn]: OmniSharp.MSBuild.ProjectManager
        Failed to load project file 'c:\Project\Test\Assembly-CSharp-Editor.csproj'.
c:\Project\Test\Assembly-CSharp-Editor.csproj
C:\Users\borr\.vscode\extensions\ms-vscode.csharp-1.16.0\.omnisharp\1.32.4\msbuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(1657,5): Error: 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 <UsingTask> in the project file, or in the *.tasks files located in the "C:\Users\borr\.vscode\extensions\ms-vscode.csharp-1.16.0\.omnisharp\1.32.4\msbuild\15.0\Bin" directory.

[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: c:\Project\Test\Assembly-CSharp-Editor-firstpass.csproj
[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 <UsingTask> in the project file, or in the *.tasks files located in the "C:\Users\borr\.vscode\extensions\ms-vscode.csharp-1.16.0\.omnisharp\1.32.4\msbuild\15.0\Bin" directory.
[warn]: OmniSharp.MSBuild.ProjectManager
        Failed to load project file 'c:\Project\Test\Assembly-CSharp-Editor-firstpass.csproj'.
c:\Project\Test\Assembly-CSharp-Editor-firstpass.csproj
C:\Users\borr\.vscode\extensions\ms-vscode.csharp-1.16.0\.omnisharp\1.32.4\msbuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(1657,5): Error: 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 <UsingTask> in the project file, or in the *.tasks files located in the "C:\Users\borr\.vscode\extensions\ms-vscode.csharp-1.16.0\.omnisharp\1.32.4\msbuild\15.0\Bin" directory.

[fail]: OmniSharp.MSBuild.ProjectManager
        Attemped to update project that is not loaded: c:\Project\Test\Assembly-CSharp.csproj
[info]: OmniSharp.MSBuild.ProjectManager
        Update project: Assembly-CSharp-firstpass
[fail]: OmniSharp.MSBuild.ProjectManager
        Attemped to update project that is not loaded: c:\Project\Test\Assembly-CSharp-Editor.csproj
[fail]: OmniSharp.MSBuild.ProjectManager
        Attemped to update project that is not loaded: c:\Project\Test\Assembly-CSharp-Editor-firstpass.csproj

OS Windows 7 SP1, Unity 2018.1 project

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
boris-741commented, Sep 13, 2018

fix with 1.16.1

0reactions
vlab22commented, Apr 9, 2019

After update everything, solved with solution below. https://developercommunity.visualstudio.com/content/problem/160494/msbuild-broken-getreferencenearesttargetframeworkt.html

Read more comments on GitHub >

github_iconTop Results From Across the Web

The "GetReferenceNearestTargetFrameworkTask" task was ...
Error The “GetReferenceNearestTargetFrameworkTask” task was not found. ... Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\Current\Bin” directory.
Read more >
Omnisharp msbuild projectloader the ... - Freelancer
It is a very important business task to be implemented over 2018. It is being built from scratch, but at the customer's technical...
Read more >
Can't Create Task 'Getreferencenearesttargetframeworktask'
dotnet msbuild command Builds a project and all of its dependencies. ... my OmniSharp output: The GetReferenceNearestTargetFrameworkTask task was not found.
Read more >
c# - OmniSharp failure: Can't create task ... - Stack Overflow
I've checked logs of OmniSharp and found following error: Failed to create instance of task "GetReferenceNearestTargetFrameworkTask" from ...
Read more >
[SOLVED] Working C# development IDE? - Arch Linux Forums
MSBuild.ProjectLoader The "ResolveAssemblyReference" task failed unexpectedly. System.TypeLoadException: Could not find method '.ctor' due ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found