vscode-csharp icon indicating copy to clipboard operation
vscode-csharp copied to clipboard

Fail: OmniSharp.MSBuild.ProjectManager, Attemped to update project that is not loaded

Open bkmalkoc opened this issue 8 years ago • 56 comments

Environment data

dotnet --info output: .NET Core SDK (reflecting any global.json): Version: 2.1.300 Commit: adab45bf0c

Runtime Environment: OS Name: Windows OS Version: 10.0.17134 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\2.1.300\

Host (useful for support): Version: 2.1.0 Commit: caa7b7e2ba

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

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

To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-download

VS Code version: 1.27.1 C# Extension version:

Steps to reproduce

OmniSharp is updated itself

Expected behavior

Project to be working

Actual behavior

OmniSharp Log:

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

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on Windows 6.2.9200.0 (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\Burak\.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\Burak\.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\Burak\.vscode\extensions\ms-vscode.csharp-1.16.0\.omnisharp\1.32.4\msbuild\15.0\Bin"
            CscToolExe = csc.exe
            CscToolPath = C:\Users\Burak\.vscode\extensions\ms-vscode.csharp-1.16.0\.omnisharp\1.32.4\msbuild\15.0\Bin\Roslyn
            MSBuildExtensionsPath = C:\Users\Burak\.vscode\extensions\ms-vscode.csharp-1.16.0\.omnisharp\1.32.4\msbuild
            MSBuildToolsPath = C:\Users\Burak\.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:\SwayPay-Marketing\ota-app-hotelbeds-content'.
[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:\SwayPay-Marketing\ota-app-hotelbeds-content\HotelContentFetcher.sln'.
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'c:\SwayPay-Marketing\ota-app-hotelbeds-content\Fetcher\HotelContentFetcher.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'c:\SwayPay-Marketing\ota-app-hotelbeds-content\FetcherTests\FetcherTests.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in 'c:\SwayPay-Marketing\ota-app-hotelbeds-content'.
[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:\SwayPay-Marketing\ota-app-hotelbeds-content' on host 16256.
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: c:\SwayPay-Marketing\ota-app-hotelbeds-content\Fetcher\HotelContentFetcher.csproj
[info]: OmniSharp.MSBuild.ProjectManager
        Successfully loaded project file 'c:\SwayPay-Marketing\ota-app-hotelbeds-content\Fetcher\HotelContentFetcher.csproj'.
[info]: OmniSharp.MSBuild.ProjectManager
        Adding project 'c:\SwayPay-Marketing\ota-app-hotelbeds-content\Fetcher\HotelContentFetcher.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: c:\SwayPay-Marketing\ota-app-hotelbeds-content\FetcherTests\FetcherTests.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\Burak\.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:\SwayPay-Marketing\ota-app-hotelbeds-content\FetcherTests\FetcherTests.csproj'.
c:\SwayPay-Marketing\ota-app-hotelbeds-content\FetcherTests\FetcherTests.csproj
C:\Users\Burak\.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\Burak\.vscode\extensions\ms-vscode.csharp-1.16.0\.omnisharp\1.32.4\msbuild\15.0\Bin" directory.

[info]: OmniSharp.MSBuild.ProjectManager
        Update project: HotelContentFetcher
[fail]: OmniSharp.MSBuild.ProjectManager
        Attemped to update project that is not loaded: c:\SwayPay-Marketing\ota-app-hotelbeds-content\FetcherTests\FetcherTests.csproj

bkmalkoc avatar Sep 10 '18 18:09 bkmalkoc

@bkmalkoc Thanks for filing--can you share your solution or tell me more about your project/folder topology? Eg, what project to project references do you have, are all of those projects in the same solution, etc?

rchande avatar Sep 10 '18 19:09 rchande

@rchande The project topology is shown below. Basically under one solution, test project and the core code under console application. image

bkmalkoc avatar Sep 10 '18 19:09 bkmalkoc

Also @bkmalkoc what kinds of projects are these? .NET Core, .NET Framework?

rchande avatar Sep 10 '18 19:09 rchande

@rchande it is .NET Core

bkmalkoc avatar Sep 10 '18 19:09 bkmalkoc

Hello. I have this same problem just after OmniSharp updated itself. There has been an update from VS Code and the dotnet-sdk recently too, not sure if it's related. I'm using Fedora 28.

djkiwe avatar Sep 10 '18 21:09 djkiwe

@bkmalkoc @djkiwe Could you try updating to the 2.1.400 release of the dotnet SDK and let me know if that helps?

rchande avatar Sep 10 '18 22:09 rchande

I am using the latest sdk release. Output of dotnet --version:

2.1.401

Output of dotnet --info:

.NET Core SDK (reflecting any global.json):
 Version:   2.1.401
 Commit:    91b1c13032

Runtime Environment:
 OS Name:     fedora
 OS Version:  28
 OS Platform: Linux
 RID:         fedora.28-x64
 Base Path:   /usr/lib64/dotnet/sdk/2.1.401/

Host (useful for support):
  Version: 2.1.3
  Commit:  N/A

.NET Core SDKs installed:
  2.1.401 [/usr/lib64/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.NETCore.App 2.1.3 [/usr/lib64/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

djkiwe avatar Sep 10 '18 22:09 djkiwe

@djkiwe Please share your omnisharp log. Thanks!

rchande avatar Sep 10 '18 22:09 rchande

Now that I double checked, my log shows different errors from @bkmalkoc 's. Although both finish with the same statement: OmniSharp.MSBuild.ProjectManager, Attemped to update project that is not loaded. Should I open a different issue? Thank you!

djkiwe avatar Sep 10 '18 22:09 djkiwe

@djkiwe Yes, please.

rchande avatar Sep 10 '18 22:09 rchande

@rchande @djkiwe I updated the .Net Core sdk to 2.1.401(latest) also updated the packages but no changes, still same error.

bkmalkoc avatar Sep 10 '18 22:09 bkmalkoc

@bkmalkoc Is it possible for you to share just the csprojs? I can't reproduce this with the base output of "dotnet new"...

rchande avatar Sep 10 '18 23:09 rchande

HotelContentFetcher.csproj

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.0</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="AWSSDK.S3" Version="3.3.23" />
    <PackageReference Include="MySql.Data.EntityFrameworkCore" Version="8.0.12" />
    <PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
  </ItemGroup>
</Project>

FetcherTests.csproj

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

  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>

    <IsPackable>false</IsPackable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
    <PackageReference Include="MSTest.TestAdapter" Version="1.3.2" />
    <PackageReference Include="MSTest.TestFramework" Version="1.3.2" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\Fetcher\HotelContentFetcher.csproj" />
  </ItemGroup>

</Project>

bkmalkoc avatar Sep 10 '18 23:09 bkmalkoc

Affecting me and others as well... See

https://github.com/OmniSharp/omnisharp-roslyn/issues/1094 https://github.com/OmniSharp/omnisharp-vscode/issues/2509 and https://github.com/OmniSharp/omnisharp-vscode/issues/2510 also

johnnyreilly avatar Sep 11 '18 12:09 johnnyreilly

This same error is also affecting me, I can no longer use the Unity Debugger

LuizPelegrini avatar Sep 11 '18 15:09 LuizPelegrini

I have completely removed everything from my computer (vscode, sdk) then reinstalled and now working. weird and foolish solution but at least I get th work going. @rchande

bkmalkoc avatar Sep 11 '18 16:09 bkmalkoc

@bkmalkoc Glad you got it working. Could you share your dotnet --info and omnisharp log from your working instance to help us understand how you fixed it?

rchande avatar Sep 11 '18 18:09 rchande

I've set my ms-vscode.csharp package.json for the 1.32.3 version release of omnisharp and updated my extension folder with this version. https://omnisharpdownload.blob.core.windows.net/ext/omnisharp-win-x64-1.32.3.zip

It worked for me.

pietro-Alterdata avatar Sep 11 '18 18:09 pietro-Alterdata

@rchande I have no clue what has changed but after clean reinstallation here is my dotnet; nothing is wrong in omnisharp tho, works with the same latest version

dotnet --info

.NET Core SDK (reflecting any global.json):
 Version:   2.1.401
 Commit:    91b1c13032

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.17134
 OS Platform: Windows
 RID:         win10-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]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

bkmalkoc avatar Sep 11 '18 20:09 bkmalkoc

@bkmalkoc glad you got it working. For others still encountering issues: We believe we have identified the cause of the "GetReferenceNearestTargetFrameworkTask" issue and we've created a beta of the C# extension that includes the fix. Please install the beta VSIX (https://github.com/OmniSharp/omnisharp-vscode/releases/download/v1.16.1-beta1/csharp-1.16.1-beta1.vsix) and let us know if that resolves the problem

rchande avatar Sep 12 '18 16:09 rchande