vscode-csharp: Problem after update to .NET SDK 2.2.202-1

Issue Description

Running into error after updating .NET SDK to 2.2.202-1 via Update Manager in Linux Mint 19.1.

Steps to Reproduce

From command line enter “dotnet new webapi -o TodoApi3”, then “cd TodoApi3”, then “code .” to open project in VS Code.

Expected Behavior

Message in VS Code asking if I want to add required assets to project.

Actual Behavior

Message: “Some projects have trouble loading. Please review the output for more details. Source: C# (Extension)”

It appears that the .vscode directory doesn’t get created, along with files launch.json and tasks.json. Workaround is to manually copy those from a prior project and fix the content of the two files to match the project name.

Logs

OmniSharp log

Starting OmniSharp server at 4/4/2019, 4:04:54 PM Target: /home/bob/projects/TodoApi3

OmniSharp server started. Path: /home/bob/.vscode/extensions/ms-vscode.csharp-1.18.0/.omnisharp/1.32.11/run PID: 9615

    Starting OmniSharp on linuxmint 19.1 (x64)
    DotNetPath set to dotnet
    Located 1 MSBuild instance(s)
        1: StandAlone 15.0 - "/home/bob/.vscode/extensions/ms-vscode.csharp-1.18.0/.omnisharp/1.32.11/omnisharp/msbuild/15.0/Bin"
    MSBUILD_EXE_PATH environment variable set to '/home/bob/.vscode/extensions/ms-vscode.csharp-1.18.0/.omnisharp/1.32.11/omnisharp/msbuild/15.0/Bin/MSBuild.dll'
    Registered MSBuild instance: StandAlone 15.0 - "/home/bob/.vscode/extensions/ms-vscode.csharp-1.18.0/.omnisharp/1.32.11/omnisharp/msbuild/15.0/Bin"
        MSBuildExtensionsPath = /home/bob/.vscode/extensions/ms-vscode.csharp-1.18.0/.omnisharp/1.32.11/omnisharp/msbuild
        BypassFrameworkInstallChecks = true
        CscToolPath = /home/bob/.vscode/extensions/ms-vscode.csharp-1.18.0/.omnisharp/1.32.11/omnisharp/msbuild/15.0/Bin/Roslyn
        CscToolExe = csc.exe
        MSBuildToolsPath = /home/bob/.vscode/extensions/ms-vscode.csharp-1.18.0/.omnisharp/1.32.11/omnisharp/msbuild/15.0/Bin
    Detecting Cake files in '/home/bob/projects/TodoApi3'.
    Could not find any Cake files
    Project system 'OmniSharp.DotNet.DotNetProjectSystem' is disabled in the configuration.
    No solution files found in '/home/bob/projects/TodoApi3'
    Queue project update for '/home/bob/projects/TodoApi3/TodoApi3.csproj'
    Detecting CSX files in '/home/bob/projects/TodoApi3'.
    Could not find any CSX files
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpWorkspaceOptionsProvider
    Configuration finished.
    Omnisharp server running using Stdio at location '/home/bob/projects/TodoApi3' on host 9534.
    Loading project: /home/bob/projects/TodoApi3/TodoApi3.csproj
    Failed to load project file '/home/bob/projects/TodoApi3/TodoApi3.csproj'.

/home/bob/projects/TodoApi3/TodoApi3.csproj(1,1) Microsoft.Build.Exceptions.InvalidProjectFileException: The SDK ‘Microsoft.NET.Sdk.Web’ specified could not be found. /home/bob/projects/TodoApi3/TodoApi3.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.Evaluator4[P,I,M,D].ExpandAndLoadImportsFromUnescapedImportExpressionConditioned (System.String directoryOfImportingFile, Microsoft.Build.Construction.ProjectImportElement importElement, System.Collections.Generic.List1[Microsoft.Build.Construction.ProjectRootElement]& projects, System.Boolean throwOnFileNotExistsError) [0x00254] in <2338fdb301034c1d9c6b95e564d514b0>:0 at Microsoft.Build.Evaluation.Evaluator4[P,I,M,D].ExpandAndLoadImports (System.String directoryOfImportingFile, Microsoft.Build.Construction.ProjectImportElement importElement) [0x00024] in <2338fdb301034c1d9c6b95e564d514b0>:0 at Microsoft.Build.Evaluation.Evaluator4[P,I,M,D].EvaluateImportElement (System.String directoryOfImportingFile, Microsoft.Build.Construction.ProjectImportElement importElement) [0x0000d] in <2338fdb301034c1d9c6b95e564d514b0>:0 at Microsoft.Build.Evaluation.Evaluator4[P,I,M,D].PerformDepthFirstPass (Microsoft.Build.Construction.ProjectRootElement currentProjectOrImport) [0x000e6] in <2338fdb301034c1d9c6b95e564d514b0>:0 at Microsoft.Build.Evaluation.Evaluator4[P,I,M,D].Evaluate (Microsoft.Build.BackEnd.Logging.ILoggingService loggingService, Microsoft.Build.Framework.BuildEventContext buildEventContext) [0x00103] in <2338fdb301034c1d9c6b95e564d514b0>:0 at Microsoft.Build.Evaluation.Evaluator4[P,I,M,D].Evaluate (Microsoft.Build.Evaluation.IEvaluatorData4[P,I,M,D] data, Microsoft.Build.Construction.ProjectRootElement root, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings, System.Int32 maxNodeCount, Microsoft.Build.Collections.PropertyDictionary1[T] environmentProperties, Microsoft.Build.BackEnd.Logging.ILoggingService loggingService, Microsoft.Build.Evaluation.IItemFactory2[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.IDictionary2[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.IDictionary2[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.IDictionary2[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.IDictionary2[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.IDictionary2[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.IDictionary2[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) [0x0003f] in <c28baf123c0744eeb7042fb581dc5633>:0 at OmniSharp.MSBuild.ProjectLoader.BuildProject (System.String filePath) [0x0000d] in <c28baf123c0744eeb7042fb581dc5633>:0 at OmniSharp.MSBuild.ProjectFile.ProjectFileInfo.Load (System.String filePath, OmniSharp.MSBuild.ProjectLoader loader) [0x00015] in <c28baf123c0744eeb7042fb581dc5633>:0 at OmniSharp.MSBuild.ProjectManager+<>c__DisplayClass28_0.<LoadProject>b__0 () [0x00000] in <c28baf123c0744eeb7042fb581dc5633>:0 at (wrapper delegate-invoke) System.Func1[System.ValueTuple3[OmniSharp.MSBuild.ProjectFile.ProjectFileInfo,System.Collections.Immutable.ImmutableArray1[OmniSharp.MSBuild.Logging.MSBuildDiagnostic],OmniSharp.MSBuild.Notification.ProjectLoadedEventArgs]].invoke_TResult() at OmniSharp.MSBuild.ProjectManager.LoadOrReloadProject (System.String projectFilePath, System.Func1[TResult] loader) [0x0001b] in <c28baf123c0744eeb7042fb581dc5633>:0

    Attempted to update project that is not loaded: /home/bob/projects/TodoApi3/TodoApi3.csproj

C# log

(nothing)

Environment information

VSCode version: 1.32.3 C# Extension: 1.18.0

Mono Information OmniSharp using built-in mono
Dotnet Information .NET Core SDK (reflecting any global.json): Version: 2.2.202 Commit: 8a7ff6789d

Runtime Environment: OS Name: linuxmint OS Version: 19.1 OS Platform: Linux RID: linux-x64 Base Path: /usr/share/dotnet/sdk/2.2.202/

Host (useful for support): Version: 2.2.3 Commit: 6b8ad509b6

.NET Core SDKs installed: 2.1.602 [/usr/share/dotnet/sdk] 2.2.202 [/usr/share/dotnet/sdk]

.NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.9 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.2.3 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.9 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.2.3 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.9 [/usr/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 2.2.3 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

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

Visual Studio Code Extensions
Extension Author Version
Angular2 johnpapa 7.0.1
angular2-switcher infinity1207 0.2.0
auto-rename-tag formulahendry 0.0.15
chilly-vscode-dark-theme ZachTRice 0.1.5
csharp ms-vscode 1.18.0
csharpextensions jchannon 1.3.0
debugger-for-chrome msjsdiag 4.11.3
material-icon-theme PKief 3.7.0
ng-template Angular 0.1.11
path-intellisense christian-kohler 1.4.2
Theme-Oblivion gerane 0.0.2
vscode-angular2-files alexiv 1.6.2
vscode-nuget-package-manager jmrog 1.1.6

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 6
  • Comments: 31 (4 by maintainers)

Most upvoted comments

For anyone trying to fix this quickly:

$ apt-cache policy dotnet-sdk-2.2 

dotnet-sdk-2.2:
  Installed: 2.2.202-1
  Candidate: 2.2.202-1
  Version table:
... 

which is followed by the list of versions

$ sudo apt install dotnet-sdk-2.2=<your version of choice> for me it was

$ sudo apt install dotnet-sdk-2.2=2.2.105-1

and confirm the downgrade

@akshita31 @rchande Success on Linux Mint 19.1 ! Thank you for getting this fixed so quickly!!

Here are the steps I followed:

In the VS Code menu, go into File / Preferences / Settings.

In the “Search settings” window, type omnisharp.path

Click on “Edit in settings.json” link. Add (or edit) like this:

{ “omnisharp.path”: “latest” }

If your settings.json already had entries in it, put a comma behind the last one and add the line like this:

{ “workbench.colorTheme”: “Solarized Light”, “omnisharp.path”: “latest” }

Save settings.json

You’ll see a prompt: “OmniSharp configuration has changed. Would you like to relaunch the OmniSharp server with your changes?” Click the “Restart OmniSharp” button to reload it.

In the Output window you’ll see updates while the latest version downloads.

Then you’ll see another prompt: “Required assets to build and debug are missing from ‘[your project name]’. Add them?” Click Yes.

You should be in business!

As a quick workaround, you can also set the MSBuildSDKsPath environment variable and point to Sdks location.

On Linux (Ubuntu 18.04 in my case) I added following to my .bashrc

export MSBuildSDKsPath =“/usr/share/dotnet/sdk/2.2.202/Sdks”

On Windows Edit System Environment Variables and add a system variable MSBuildSDKsPath and set to C:\Program Files\dotnet\sdk\2.2.202\Sdks

Thanks for the fix - can confirm working on Ubuntu 18.04, dotnet SDK 2.2.203, with the { “omnisharp.path”: “latest” }

in VS Code settings.json

@rchande @akshita31 Thank you for your work on this.

@welkie We don’t comment on release dates, but a build is available: https://github.com/OmniSharp/omnisharp-vscode/releases/tag/v1.19.0

Thank you, @leawp! Mint Cinnamon 19.1, here!

Thanks @leawp this also works for me on Mint 19.1.

I can confirm… Many of my projects used to work until I updated to 2.2.202-1 today; Seeing a missing “Microsoft.NET.Sdk’” in my console apps or "‘Microsoft.NET.Sdk.Web’ in my web apps…