Solvedomnisharp vscode [fail]: OmniSharp.MSBuild.ProjectManager: Attemped to update project that is not loaded.

Environment data

dotnet --info output:

.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

VS Code version: 1.27.1
C# Extension version: 1.16.0

Steps to reproduce

None. Projects are not loaded by OmniSharp.

Expected behavior

Projects to be loaded.

Actual behavior

I am currently working in 2 .net core projects. Neither is loaded by OmniSharp when I open them in VS Code.

Extra information

OmniSharp Log:

Starting OmniSharp server at 9/10/2018, 5:31:03 PM
    Target: /home/c4talyst/Projects/frave/frave-Signatures

OmniSharp server started.
    Path: /home/c4talyst/.vscode/extensions/ms-vscode.csharp-1.16.0/.omnisharp/1.32.4/run
    PID: 5955

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on fedora 28.0 (x64)
[info]: OmniSharp.Services.DotNetCliService
        DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 1 MSBuild instance(s)
            1: StandAlone 15.0 - "/home/c4talyst/.vscode/extensions/ms-vscode.csharp-1.16.0/.omnisharp/1.32.4/omnisharp/msbuild/15.0/Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        MSBUILD_EXE_PATH environment variable set to '/home/c4talyst/.vscode/extensions/ms-vscode.csharp-1.16.0/.omnisharp/1.32.4/omnisharp/msbuild/15.0/Bin/MSBuild.dll'
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: StandAlone 15.0 - "/home/c4talyst/.vscode/extensions/ms-vscode.csharp-1.16.0/.omnisharp/1.32.4/omnisharp/msbuild/15.0/Bin"
            MSBuildExtensionsPath = /home/c4talyst/.vscode/extensions/ms-vscode.csharp-1.16.0/.omnisharp/1.32.4/omnisharp/msbuild
            BypassFrameworkInstallChecks = true
            CscToolPath = /home/c4talyst/.vscode/extensions/ms-vscode.csharp-1.16.0/.omnisharp/1.32.4/omnisharp/msbuild/15.0/Bin/Roslyn
            CscToolExe = csc.exe
            MSBuildToolsPath = /home/c4talyst/.vscode/extensions/ms-vscode.csharp-1.16.0/.omnisharp/1.32.4/omnisharp/msbuild/15.0/Bin
[info]: OmniSharp.Cake.CakeProjectSystem
        Detecting Cake files in '/home/c4talyst/Projects/frave/frave-Signatures'.
[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
        No solution files found in '/home/c4talyst/Projects/frave/frave-Signatures'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for '/home/c4talyst/Projects/frave/frave-Signatures/frave-Signatures.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in '/home/c4talyst/Projects/frave/frave-Signatures'.
[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.MSBuild.ProjectManager
        Loading project: /home/c4talyst/Projects/frave/frave-Signatures/frave-Signatures.csproj
[info]: OmniSharp.Stdio.Host
        Configuration finished.
[info]: OmniSharp.Stdio.Host
        Omnisharp server running using Stdio at location '/home/c4talyst/Projects/frave/frave-Signatures' on host 5883.
[warn]: OmniSharp.MSBuild.ProjectManager
        Failed to load project file '/home/c4talyst/Projects/frave/frave-Signatures/frave-Signatures.csproj'.
/home/c4talyst/Projects/frave/frave-Signatures/frave-Signatures.csproj(1,1)
Microsoft.Build.Exceptions.InvalidProjectFileException: The SDK 'Microsoft.NET.Sdk.Web' specified could not be found.  /home/c4talyst/Projects/frave/frave-Signatures/frave-Signatures.csproj
  at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject (System.String errorSubCategoryResourceName, Microsoft.Build.Shared.IElementLocation elementLocation, System.String resourceName, System.Object[] args) [0x00040] in <2338fdb301034c1d9c6b95e564d514b0>:0 
  at Microsoft.Build.Shared.ProjectErrorUtilities.VerifyThrowInvalidProject[T1] (System.Boolean condition, System.String errorSubCategoryResourceName, Microsoft.Build.Shared.IElementLocation elementLocation, System.String resourceName, T1 arg0) [0x00003] in <2338fdb301034c1d9c6b95e564d514b0>:0 
  at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject[T1] (Microsoft.Build.Shared.IElementLocation elementLocation, System.String resourceName, T1 arg0) [0x00000] in <2338fdb301034c1d9c6b95e564d514b0>:0 
  at Microsoft.Build.Evaluation.Evaluator`4[P,I,M,D].ExpandAndLoadImportsFromUnescapedImportExpressionConditioned (System.String directoryOfImportingFile, Microsoft.Build.Construction.ProjectImportElement importElement, System.Collections.Generic.List`1[Microsoft.Build.Construction.ProjectRootElement]& projects, System.Boolean throwOnFileNotExistsError) [0x00254] in <2338fdb301034c1d9c6b95e564d514b0>:0 
  at Microsoft.Build.Evaluation.Evaluator`4[P,I,M,D].ExpandAndLoadImports (System.String directoryOfImportingFile, Microsoft.Build.Construction.ProjectImportElement importElement) [0x00024] in <2338fdb301034c1d9c6b95e564d514b0>:0 
  at Microsoft.Build.Evaluation.Evaluator`4[P,I,M,D].EvaluateImportElement (System.String directoryOfImportingFile, Microsoft.Build.Construction.ProjectImportElement importElement) [0x0000d] in <2338fdb301034c1d9c6b95e564d514b0>:0 
  at Microsoft.Build.Evaluation.Evaluator`4[P,I,M,D].PerformDepthFirstPass (Microsoft.Build.Construction.ProjectRootElement currentProjectOrImport) [0x000e6] in <2338fdb301034c1d9c6b95e564d514b0>:0 
  at Microsoft.Build.Evaluation.Evaluator`4[P,I,M,D].Evaluate (Microsoft.Build.BackEnd.Logging.ILoggingService loggingService, Microsoft.Build.Framework.BuildEventContext buildEventContext) [0x00103] in <2338fdb301034c1d9c6b95e564d514b0>:0 
  at Microsoft.Build.Evaluation.Evaluator`4[P,I,M,D].Evaluate (Microsoft.Build.Evaluation.IEvaluatorData`4[P,I,M,D] data, Microsoft.Build.Construction.ProjectRootElement root, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings, System.Int32 maxNodeCount, Microsoft.Build.Collections.PropertyDictionary`1[T] environmentProperties, Microsoft.Build.BackEnd.Logging.ILoggingService loggingService, Microsoft.Build.Evaluation.IItemFactory`2[S,T] itemFactory, Microsoft.Build.Evaluation.IToolsetProvider toolsetProvider, Microsoft.Build.Evaluation.ProjectRootElementCache projectRootElementCache, Microsoft.Build.Framework.BuildEventContext buildEventContext, Microsoft.Build.Execution.ProjectInstance projectInstanceIfAnyForDebuggerOnly, Microsoft.Build.BackEnd.SdkResolution.ISdkResolverService sdkResolverService, System.Int32 submissionId, Microsoft.Build.Evaluation.Context.EvaluationContext evaluationContext) [0x0001a] in <2338fdb301034c1d9c6b95e564d514b0>:0 
  at Microsoft.Build.Evaluation.Project.Reevaluate (Microsoft.Build.BackEnd.Logging.ILoggingService loggingServiceForEvaluation, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings) [0x0004c] in <2338fdb301034c1d9c6b95e564d514b0>:0 
  at Microsoft.Build.Evaluation.Project.ReevaluateIfNecessary (Microsoft.Build.BackEnd.Logging.ILoggingService loggingServiceForEvaluation, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings) [0x00034] in <2338fdb301034c1d9c6b95e564d514b0>:0 
  at Microsoft.Build.Evaluation.Project.ReevaluateIfNecessary (Microsoft.Build.BackEnd.Logging.ILoggingService loggingServiceForEvaluation) [0x00000] in <2338fdb301034c1d9c6b95e564d514b0>:0 
  at Microsoft.Build.Evaluation.Project.ReevaluateIfNecessary (Microsoft.Build.Evaluation.Context.EvaluationContext evaluationContext) [0x00023] in <2338fdb301034c1d9c6b95e564d514b0>:0 
  at Microsoft.Build.Evaluation.Project.Initialize (System.Collections.Generic.IDictionary`2[TKey,TValue] globalProperties, System.String toolsVersion, System.String subToolsetVersion, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings, Microsoft.Build.Evaluation.Context.EvaluationContext evaluationContext) [0x00126] in <2338fdb301034c1d9c6b95e564d514b0>:0 
  at Microsoft.Build.Evaluation.Project..ctor (System.String projectFile, System.Collections.Generic.IDictionary`2[TKey,TValue] globalProperties, System.String toolsVersion, System.String subToolsetVersion, Microsoft.Build.Evaluation.ProjectCollection projectCollection, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings, Microsoft.Build.Evaluation.Context.EvaluationContext evaluationContext) [0x0009e] in <2338fdb301034c1d9c6b95e564d514b0>:0 
  at Microsoft.Build.Evaluation.Project..ctor (System.String projectFile, System.Collections.Generic.IDictionary`2[TKey,TValue] globalProperties, System.String toolsVersion, System.String subToolsetVersion, Microsoft.Build.Evaluation.ProjectCollection projectCollection, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings) [0x00000] in <2338fdb301034c1d9c6b95e564d514b0>:0 
  at Microsoft.Build.Evaluation.Project..ctor (System.String projectFile, System.Collections.Generic.IDictionary`2[TKey,TValue] globalProperties, System.String toolsVersion, Microsoft.Build.Evaluation.ProjectCollection projectCollection, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings) [0x00000] in <2338fdb301034c1d9c6b95e564d514b0>:0 
  at Microsoft.Build.Evaluation.Project..ctor (System.String projectFile, System.Collections.Generic.IDictionary`2[TKey,TValue] globalProperties, System.String toolsVersion, Microsoft.Build.Evaluation.ProjectCollection projectCollection) [0x00000] in <2338fdb301034c1d9c6b95e564d514b0>:0 
  at Microsoft.Build.Evaluation.ProjectCollection.LoadProject (System.String fileName, System.Collections.Generic.IDictionary`2[TKey,TValue] globalProperties, System.String toolsVersion) [0x000f5] in <2338fdb301034c1d9c6b95e564d514b0>:0 
  at Microsoft.Build.Evaluation.ProjectCollection.LoadProject (System.String fileName, System.String toolsVersion) [0x00000] in <2338fdb301034c1d9c6b95e564d514b0>:0 
  at OmniSharp.MSBuild.ProjectLoader.EvaluateProjectFileCore (System.String filePath) [0x0003e] in <ac1d56eec6e94984a567e44be53468d1>:0 
  at OmniSharp.MSBuild.ProjectLoader.BuildProject (System.String filePath) [0x0000d] in <ac1d56eec6e94984a567e44be53468d1>:0 
  at OmniSharp.MSBuild.ProjectFile.ProjectFileInfo.Load (System.String filePath, OmniSharp.MSBuild.ProjectLoader loader) [0x00014] in <ac1d56eec6e94984a567e44be53468d1>:0 
  at OmniSharp.MSBuild.ProjectManager+<>c__DisplayClass24_0.<LoadProject>b__0 () [0x00000] in <ac1d56eec6e94984a567e44be53468d1>:0 
  at (wrapper delegate-invoke) System.Func`1[System.ValueTuple`2[OmniSharp.MSBuild.ProjectFile.ProjectFileInfo,System.Collections.Immutable.ImmutableArray`1[OmniSharp.MSBuild.Logging.MSBuildDiagnostic]]].invoke_TResult()
  at OmniSharp.MSBuild.ProjectManager.LoadOrReloadProject (System.String projectFilePath, System.Func`1[TResult] loadFunc) [0x0001b] in <ac1d56eec6e94984a567e44be53468d1>:0 

[fail]: OmniSharp.MSBuild.ProjectManager
        Attemped to update project that is not loaded: /home/c4talyst/Projects/frave/frave-Signatures/frave-Signatures.csproj
35 Answers

✔️Accepted Answer

Thanks a bunch! This solved the issue for me.

Steps taken

  1. Download version 1.15.2 (see link above, or the releases page)
  2. Uninstall the C# extension in VSCode
  3. Ctrl+Shift+P Extensions: Disable Auto Updating Extensions Enter
  4. Ctrl+Shift+P Extensions: Install from VSIX...Enter
  5. Reload VSCode

Other Answers:

Here is .vsix installer from this repository in case you need a quick workaround.
csharp-1.15.2.zip

Thanks a bunch! This solved the issue for me.

Steps taken

  1. Download version 1.15.2 (see link above, or the releases page)
  2. Uninstall the C# extension in VSCode
  3. Ctrl+Shift+P Extensions: Disable Auto Updating Extensions Enter
  4. Ctrl+Shift+P Extensions: Install from VSIX...Enter
  5. Reload VSCode

Thanks for the solution

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

It worked for me

C# for Visual Studio Code v 1.22.1
VSCode v 1.46.1

Thanks to @Ghostbird @w1dg3r @Noeyedeerwhy

More Issues: