Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
bkmalkoc opened this issue Sep 10, 2018 · 56 comments

Comments

@bkmalkoc
Copy link

bkmalkoc commented Sep 10, 2018

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
@rchande
Copy link

rchande commented Sep 10, 2018

@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?

@bkmalkoc
Copy link
Author

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

@rchande
Copy link

rchande commented Sep 10, 2018

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

@bkmalkoc
Copy link
Author

bkmalkoc commented Sep 10, 2018

@rchande it is .NET Core

@djkiwe
Copy link

djkiwe commented Sep 10, 2018

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.

@rchande
Copy link

rchande commented Sep 10, 2018

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

@djkiwe
Copy link

djkiwe commented Sep 10, 2018

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

@rchande
Copy link

rchande commented Sep 10, 2018

@djkiwe Please share your omnisharp log. Thanks!

@djkiwe
Copy link

djkiwe commented Sep 10, 2018

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!

@rchande
Copy link

rchande commented Sep 10, 2018

@djkiwe Yes, please.

@bkmalkoc
Copy link
Author

bkmalkoc commented Sep 10, 2018

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

@rchande
Copy link

rchande commented Sep 10, 2018

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

@bkmalkoc
Copy link
Author

bkmalkoc commented Sep 10, 2018

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>

@johnnyreilly
Copy link

johnnyreilly commented Sep 11, 2018

Affecting me and others as well... See

OmniSharp/omnisharp-roslyn#1094
#2509 and #2510 also

@LuizPelegrini
Copy link

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

@bkmalkoc
Copy link
Author

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

@rchande
Copy link

rchande commented Sep 11, 2018

@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?

@pietro-Alterdata
Copy link

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.

@bkmalkoc
Copy link
Author

@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

@rchande
Copy link

rchande commented Sep 12, 2018

@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

@farzadmf
Copy link

I downloaded and installed the beta version, but I still have an error.

I'm not sure if I'm getting the same error as the other guys, but this is what I see

Microsoft.Build.Exceptions.InvalidProjectFileException: Could not load SDK Resolver. A manifest file exists, but the path to the SDK Resolver DLL file could not be found. Manifest file path 'C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\SdkResolvers\Microsoft.Build.NuGetSdkResolver\Microsoft.Build.NuGetSdkResolver.xml'. SDK resolver path: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\CommonExtensions\Microsoft\NuGet\Microsoft.Build.NuGetSdkResolver.dll  d:\temp\temp-dotnet\temp-hackerrank\hackerrank-scratchpad\array-left-rotation\array-left-rotation.csproj

And the output of my 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.105 [C:\Program Files\dotnet\sdk]
  2.1.200 [C:\Program Files\dotnet\sdk]
  2.1.202 [C:\Program Files\dotnet\sdk]
  2.1.300 [C:\Program Files\dotnet\sdk]
  2.1.302 [C:\Program Files\dotnet\sdk]
  2.1.400 [C:\Program Files\dotnet\sdk]
  2.1.401 [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.All 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.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

@CTJansson
Copy link

I had this problem recently, I thought I had everything installed even mono, but I didn't have mono-complete installed just a few packages it seems, it solved my problem. People could try that and see if it solves thier problems.

@FranklinWhale
Copy link

@rchande I have getting the same error using both 1.16.2 and 1.17.0...

The project was generated using dotnet new console -o EfCoreTest

The VS Code output log as follows:

Starting OmniSharp server at 10/15/2018, 2:56:15 PM
    Target: c:\Users\Franklin\Documents\EfCoreTest

OmniSharp server started.
    Path: C:\Users\Franklin\.vscode\extensions\ms-vscode.csharp-1.17.0\.omnisharp\1.32.6\OmniSharp.exe
    PID: 5808

[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 3 MSBuild instance(s)
            1: Visual Studio Build Tools 2017 15.8.28010.2041 - "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin"
            2: Visual Studio Community 2017 15.8.28010.2041 - "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin"
            3: StandAlone 15.0 - "C:\Users\Franklin\.vscode\extensions\ms-vscode.csharp-1.17.0\.omnisharp\1.32.6\msbuild\15.0\Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: Visual Studio Build Tools 2017 15.8.28010.2041 - "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin"
[info]: OmniSharp.Cake.CakeProjectSystem
        Detecting Cake files in 'c:\Users\Franklin\Documents\EfCoreTest'.
[info]: OmniSharp.Cake.CakeProjectSystem
        Could not find any Cake files
[info]: OmniSharp.WorkspaceInitializer
        Project system 'OmniSharp.DotNet.DotNetProjectSystem' is disabled in the configuration.
[info]: OmniSharp.MSBuild.ProjectSystem
        No solution files found in 'c:\Users\Franklin\Documents\EfCoreTest'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'c:\Users\Franklin\Documents\EfCoreTest\EfCoreTest.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in 'c:\Users\Franklin\Documents\EfCoreTest'.
[info]: OmniSharp.Script.ScriptProjectSystem
        Could not find any CSX files
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpWorkspaceOptionsProvider
[info]: OmniSharp.WorkspaceInitializer
        Configuration finished.
[info]: OmniSharp.Stdio.Host
        Omnisharp server running using Stdio at location 'c:\Users\Franklin\Documents\EfCoreTest' on host 8780.
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: c:\Users\Franklin\Documents\EfCoreTest\EfCoreTest.csproj
[warn]: OmniSharp.MSBuild.ProjectManager
        Failed to load project file 'c:\Users\Franklin\Documents\EfCoreTest\EfCoreTest.csproj'.
c:\Users\Franklin\Documents\EfCoreTest\EfCoreTest.csproj(1,1)
Microsoft.Build.Exceptions.InvalidProjectFileException: Could not load SDK Resolver. A manifest file exists, but the path to the SDK Resolver DLL file could not be found. Manifest file path 'C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\SdkResolvers\Microsoft.Build.NuGetSdkResolver\Microsoft.Build.NuGetSdkResolver.xml'. SDK resolver path: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\CommonExtensions\Microsoft\NuGet\Microsoft.Build.NuGetSdkResolver.dll  c:\Users\Franklin\Documents\EfCoreTest\EfCoreTest.csproj
   at Microsoft.Build.Shared.ProjectFileErrorUtilities.VerifyThrowInvalidProjectFile(Boolean condition, String errorSubCategoryResourceName, BuildEventFileInfo projectFile, Exception innerException, String resourceName, Object[] args)
   at Microsoft.Build.BackEnd.SdkResolution.SdkResolverLoader.TryAddAssemblyFromManifest(String pathToManifest, String manifestFolder, List`1 assembliesList, ElementLocation location)
   at Microsoft.Build.BackEnd.SdkResolution.SdkResolverLoader.FindPotentialSdkResolvers(String rootFolder, ElementLocation location)
   at Microsoft.Build.BackEnd.SdkResolution.SdkResolverLoader.LoadResolvers(LoggingContext loggingContext, ElementLocation location)
   at Microsoft.Build.BackEnd.SdkResolution.SdkResolverService.Initialize(LoggingContext loggingContext, ElementLocation location)
   at Microsoft.Build.BackEnd.SdkResolution.SdkResolverService.ResolveSdk(Int32 submissionId, SdkReference sdk, LoggingContext loggingContext, ElementLocation sdkReferenceLocation, String solutionPath, String projectPath)
   at Microsoft.Build.BackEnd.SdkResolution.CachingSdkResolverService.<>c__DisplayClass3_0.<ResolveSdk>b__0(String key)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at Microsoft.Build.BackEnd.SdkResolution.CachingSdkResolverService.ResolveSdk(Int32 submissionId, SdkReference sdk, LoggingContext loggingContext, ElementLocation sdkReferenceLocation, String solutionPath, String projectPath)
   at Microsoft.Build.Evaluation.Evaluator`4.ExpandAndLoadImportsFromUnescapedImportExpressionConditioned(String directoryOfImportingFile, ProjectImportElement importElement, List`1& projects, SdkResult& sdkResult, Boolean throwOnFileNotExistsError)
   at Microsoft.Build.Evaluation.Evaluator`4.ExpandAndLoadImports(String directoryOfImportingFile, ProjectImportElement importElement, SdkResult& sdkResult)
   at Microsoft.Build.Evaluation.Evaluator`4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement)
   at Microsoft.Build.Evaluation.Evaluator`4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport)
   at Microsoft.Build.Evaluation.Evaluator`4.Evaluate(ILoggingService loggingService, BuildEventContext buildEventContext)
   at Microsoft.Build.Evaluation.Project.Reevaluate(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
   at Microsoft.Build.Evaluation.Project.ReevaluateIfNecessary(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
   at Microsoft.Build.Evaluation.Project.Initialize(IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
   at Microsoft.Build.Evaluation.Project..ctor(String projectFile, IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectCollection projectCollection, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
   at Microsoft.Build.Evaluation.ProjectCollection.LoadProject(String fileName, IDictionary`2 globalProperties, String toolsVersion)
   at OmniSharp.MSBuild.ProjectLoader.EvaluateProjectFileCore(String filePath)
   at OmniSharp.MSBuild.ProjectLoader.BuildProject(String filePath)
   at OmniSharp.MSBuild.ProjectFile.ProjectFileInfo.Load(String filePath, ProjectLoader loader)
   at OmniSharp.MSBuild.ProjectManager.LoadOrReloadProject(String projectFilePath, Func`1 loader)

[fail]: OmniSharp.MSBuild.ProjectManager
        Attemped to update project that is not loaded: c:\Users\Franklin\Documents\EfCoreTest\EfCoreTest.csproj

The dotnet --info output is:

.NET Core SDK (reflecting any global.json):
 Version:   2.1.403
 Commit:    04e15494b6

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.403\

Host (useful for support):
  Version: 2.1.5
  Commit:  290303f510

.NET Core SDKs installed:
  2.1.202 [C:\Program Files\dotnet\sdk]
  2.1.401 [C:\Program Files\dotnet\sdk]
  2.1.402 [C:\Program Files\dotnet\sdk]
  2.1.403 [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.All 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

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

@ErikSharp
Copy link

@FranklinWhale @farzadmf - I had the same problem as you guys and the problem is that Omnisharp is choosing the MS Build instance for Visual Studio Build Tools 2017 as stated below:

Registered MSBuild instance: Visual Studio Build Tools 2017 15.8.28010.2041

As the exception says, the manifest file does exist, but if you look in it, it lists a relative path that is supposed to go to the SDK resolver. The path does not have the file listed nor some of the folders.

If you check the second MS Build instance listed, you will notice that the path does resolve to the correct file.

I couldn't figure out how to force Omnisharp to choose a different MS Build instance, so the fix I came up with was just to uninstall Visual Studio.

@farzadmf
Copy link

@ErikSharp I found some workarounds that resolved the issue for me, more specifically:

Unfortunately, the issue doesn't seem to be considered serious here as none of the maintainers has commented on this.

@akshita31
Copy link
Contributor

@FranklinWhale Can you try the workaround as suggested by @farzadmf and see if that helps

@FranklinWhale
Copy link

@akshita31 After the Build Tools is uninstalled, the error no longer occurs.

@akshita31 akshita31 reopened this Oct 18, 2018
@FranklinWhale
Copy link

@akshita31, @rchande: Is there any update on this issue? I am unable to have VS Build Tools and VS code on the same machine now...

@pikadun
Copy link

pikadun commented Nov 6, 2018

昨天安装了window build tools 之后,也出现了同样的问题

@damianpawski
Copy link

Hi, Any update on this as I am experiencing the same issue.

@rchande
Copy link

rchande commented Nov 26, 2018

@FranklinWhale When you installed the Build Tools, did you include the .NET Core Build Tools workload?

@FranklinWhale
Copy link

@rchande Probably no, because the Build Tools is for C++ only. I build .NET Core applications via dotnet build.

@rchande
Copy link

rchande commented Nov 26, 2018

@FranklinWhale How are you installing the build tools?

@FranklinWhale
Copy link

@rchande

  1. Download Build Tools for Visual Studio 2017 at https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2017
  2. Run the installer
  3. Select Visual C++ build tools

build-tools-installation

@ow-en
Copy link

ow-en commented Nov 30, 2018

+1 on this issue, and as the above has noted, uninstalling build-tools does not seem like a practical/tenable workaround.

@mjharper84
Copy link

I also have this issue - in my case the latest Node installation (10.13.0) had an option to install ms build tools

@akshita31
Copy link
Contributor

The solution here might be to install the .NET Core Build tools as stated in a similar issue here: OmniSharp/omnisharp-roslyn#1311 (comment)

@akshita31
Copy link
Contributor

@owensource @mjharper84 @FranklinWhale Can you try doing the above and checking if it works ?

@FranklinWhale
Copy link

@akshita31 That works and I now know via OmniSharp/omnisharp-roslyn#1311 that:

  1. It is not currently possible to detect whether .NET Core support is present in a MSBuild
  2. Option to control whether MSBuild to use has not been implemented yet and is currently tracked by Provide options to control MSBuild discovery and selection OmniSharp/omnisharp-roslyn#1186

@ShenduoZhang
Copy link

Same issue on MacBook Pro 15 2018, Latest Mojave. Project was created in virtual windows.

@jadesong-nsuslab
Copy link

In my case, I updated 2.1 to 2.2 and then occcured same issue.

@ShenduoZhang
Copy link

ShenduoZhang commented Dec 14, 2018

One more thing to say, things work well in Visual Studio(in virtual Win 10), but not in Visual Studio Code(Mojave).
I can reproduce it and send you the log. I've get my project done in virtual machine, but this really troubled me a lot. My laptop cannot run virtual for hours without a plugin.😂

@colotiline
Copy link

Fixed by reinstalling Omnisharp extension in VS Code.

@mjharper84
Copy link

The suggestion to install .net core build tools by @akshita31 fixed it for me, reinstalling Omnisharp did not fix it https://user-images.githubusercontent.com/3347530/46700117-8e488e80-cbe1-11e8-851c-13cbd8587815.png

@akshita31
Copy link
Contributor

For everyone who hits this issue, please install the ".NET Core Build Tools" workload in Visual Studio.

@akshita31
Copy link
Contributor

@martyrzsd Please file a separate issue with the relevant environment information.

It appears that we know the solution to this issue and there is more work being tracked here: OmniSharp/omnisharp-roslyn#1186, that will make the experience better.

I will close this issue now. If there are any remaining concerns please let us know

@phillijw
Copy link

Solution for me was to update csproj to target 2.1 instead of 2.0 because I had 2.1 sdk installed.

@Moortiii
Copy link

Moortiii commented Apr 15, 2019

I realize that the origin poster was on Windows, but this problem occured for me on Linux and I couldn't find a solution in any of the top threads. I'm not sure why, but the official mono-documentations says:

The package mono-complete should be installed to install everything - this should cover most cases of "assembly not found" errors.

At best I feel like this is highly misleading as it does not install compile-dependencies. If you're on a linux distribution, follow the instructions at this link to install the mono-devel package. At the time of writing this can be done using: sudo apt install mono-devel on Ubuntu 18.04. After that, you may need to install mono-complete as well, but this finally fixed the errors for me.

@utybo
Copy link

utybo commented Apr 28, 2019

I encountered this issue, was resolved by uninstalling the VS 2017 Build Tools I had installed.

@mm-jeremy
Copy link

@Moortiii Downloading and installing Mono from your link worked for me on MacOS Mojave 10.14.5. Thanks!

@mslot
Copy link

mslot commented May 10, 2020

I am on Windows 10 using VS Code, WSL and Spacemacs.

I had this issue as well, and found out, if i build my projects under WSL, with dotnet, that is, dotnet under linux, i had a lot of references i obj/[project_name].csproj.nuget.dgspec.json pointing to Linux paths (/mnt/ etc) when using plain dotnet and Windows paths (C:// etc) when using dotnet.exe from WSL. I think Omnisharp needs this info somehow.

By deleting all my obj folders (I deleted bin folders also just to be safe) in by project, and restarted VS Code, it helped. I got intellisense back, both in VS Code and Spacemacs. If using WSL, build your projects with dotnet.exe instead of plain dotnet.

Hope this helps someone.

ethanchewy added a commit to ethanchewy/runner that referenced this issue Jun 8, 2020
VS code versions > 2019 doesn't yet support important libraries that are needed to run runner such as .NET, etc. 

Ex: dotnet/vscode-csharp#2507
@tanerhacioglu
Copy link

resolving when installing older and stable sdk version

@NateCollins11
Copy link

I was stuck with this issue and pretty much the exact same error log and nothing I saw on forums solved it for about a week, but in the end all I had to do was install the latest mono and change the "Omnisharp: Use Global Mono" to always, and then it was fine.

I had tried about 50 things to get omnisharp working, so its possible that something else i did contributed to it eventually working, but I figured I would put this here in case anyone has the same problem that I was having.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests