dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.86k stars 672 forks source link

Omnisharp.msbuild.projectmanager - failed to load project file - no IntelliSense #3049

Closed solrevdev closed 5 years ago

solrevdev commented 5 years ago

Issue Type: Bug

Steps

To recreate create a new console app and open vscode or vscode insiders and view the output window for errors.

mkdir testconsole
cd testconsole 

dotnet new console 
code-insiders -r .

System Info

dotnet --info && mono -V
.NET Core SDK (reflecting any global.json):
 Version:   2.2.101
 Commit:    236713b0b7

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  19.04
 OS Platform: Linux
 RID:         linux-x64
 Base Path:   /usr/share/dotnet/sdk/2.2.101/

Host (useful for support):
  Version: 2.2.0
  Commit:  1249f08fed

.NET Core SDKs installed:
  2.1.502 [/usr/share/dotnet/sdk]
  2.2.101 [/usr/share/dotnet/sdk]

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

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download
Mono JIT compiler version 5.18.0.240 (Debian 5.18.0.240+dfsg-2ubuntu2 Wed Apr 17 23:39:09 UTC 2019)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
    TLS:           __thread
    SIGSEGV:       altstack
    Notifications: epoll
    Architecture:  amd64
    Disabled:      none
    Misc:          softdebug 
    Interpreter:   yes
    LLVM:          supported, not enabled.
    Suspend:       preemptive
    GC:            sgen (concurrent by default)

neofetch
            .-/+oossssoo+/-.               solrevdev@hplaptop 
        `:+ssssssssssssssssss+:`           ------------------ 
      -+ssssssssssssssssssyyssss+-         OS: Ubuntu 19.04 x86_64 
    .ossssssssssssssssssdMMMNysssso.       Host: HP 250 G6 Notebook PC 
   /ssssssssssshdmmNNmmyNMMMMhssssss/      Kernel: 5.0.0-13-generic 
  +ssssssssshmydMMMMMMMNddddyssssssss+     Uptime: 17 mins 
 /sssssssshNMMMyhhyyyyhmNMMMNhssssssss/    Packages: 2401 (dpkg), 21 (snap) 
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Shell: bash 5.0.3 
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   Resolution: 1920x1080 
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   DE: GNOME 3.32.0 
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   WM: GNOME Shell 
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   WM Theme: Adwaita 
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Theme: Yaru [GTK2/3] 
 /sssssssshNMMMyhhyyyyhdNMMMNhssssssss/    Icons: Yaru [GTK2/3] 
  +sssssssssdmydMMMMMMMMddddyssssssss+     Terminal: gnome-terminal 
   /ssssssssssshdmNNNNmyNMMMMhssssss/      CPU: Intel i5-7200U (4) @ 3.100GHz 
    .ossssssssssssssssssdMMMNysssso.       GPU: Intel HD Graphics 620 
      -+sssssssssssssssssyyyssss+-         Memory: 3449MiB / 7891MiB 
        `:+ssssssssssssssssss+:`
            .-/+oossssoo+/-.                                       

solrevdev@hplaptop:~$ screenfetch
                          ./+o+-       solrevdev@hplaptop
                  yyyyy- -yyyyyy+      OS: Ubuntu 19.04 disco
               ://+//////-yyyyyyo      Kernel: x86_64 Linux 5.0.0-13-generic
           .++ .:/++++++/-.+sss/`      Uptime: 17m
         .:++o:  /++++++++/:--:/-      Packages: 2346
        o:+o+:++.`..```.-/oo+++++/     Shell: bash 5.0.3
       .:+o:+o/.          `+sssoo+/    Resolution: 1920x1080
  .++/+:+oo+o:`             /sssooo.   DE: GNOME 
 /+++//+:`oo+o               /::--:.   WM: GNOME Shell
 \+/+o+++`o++o               ++////.   WM Theme: Adwaita
  .++.o+++oo+:`             /dddhhh.   GTK Theme: Yaru [GTK2/3]
       .+.o+oo:.          `oddhhhh+    Icon Theme: Yaru
        \+.++o+o``-````.:ohdhhhhh+     Font: Ubuntu 11
         `:o+++ `ohhhhhhhhyo++os:      CPU: Intel Core i5-7200U @ 4x 3.1GHz [27.8°C]
           .o:`.syhhhhhhh/.oo++o`      GPU: intel
               /osyyyyyyo++ooo+++/     RAM: 3139MiB / 7891MiB
                   ````` +oo+++o\:    
                          `oo++.      

Output window

Starting OmniSharp server at 07/05/2019, 00:02:44
    Target: /home/solrevdev/Code/scratch/testconsole

OmniSharp server started with Mono 5.18.0.
    Path: /home/solrevdev/.vscode-insiders/extensions/ms-vscode.csharp-1.19.0/.omnisharp/1.32.18/omnisharp/OmniSharp.exe
    PID: 8502

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on ubuntu 19.4 (x64)
[info]: OmniSharp.Services.DotNetCliService
        DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 1 MSBuild instance(s)
            1: StandAlone 15.0 - "/home/solrevdev/.vscode-insiders/extensions/ms-vscode.csharp-1.19.0/.omnisharp/1.32.18/omnisharp/.msbuild/Current/Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        MSBUILD_EXE_PATH environment variable set to '/home/solrevdev/.vscode-insiders/extensions/ms-vscode.csharp-1.19.0/.omnisharp/1.32.18/omnisharp/.msbuild/Current/Bin/MSBuild.dll'
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: StandAlone 15.0 - "/home/solrevdev/.vscode-insiders/extensions/ms-vscode.csharp-1.19.0/.omnisharp/1.32.18/omnisharp/.msbuild/Current/Bin"
            MSBuildExtensionsPath = /usr/lib/mono/xbuild
            BypassFrameworkInstallChecks = true
            CscToolPath = /home/solrevdev/.vscode-insiders/extensions/ms-vscode.csharp-1.19.0/.omnisharp/1.32.18/omnisharp/.msbuild/Current/Bin/Roslyn
            CscToolExe = csc.exe
            MSBuildToolsPath = /home/solrevdev/.vscode-insiders/extensions/ms-vscode.csharp-1.19.0/.omnisharp/1.32.18/omnisharp/.msbuild/Current/Bin
            TargetFrameworkRootPath = /usr/lib/mono/xbuild-frameworks
[info]: OmniSharp.Cake.CakeProjectSystem
        Detecting Cake files in '/home/solrevdev/Code/scratch/testconsole'.
[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 '/home/solrevdev/Code/scratch/testconsole'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for '/home/solrevdev/Code/scratch/testconsole/testconsole.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in '/home/solrevdev/Code/scratch/testconsole'.
[info]: OmniSharp.Script.ScriptProjectSystem
        Could not find any CSX files
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpWorkspaceOptionsProvider
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: /home/solrevdev/Code/scratch/testconsole/testconsole.csproj
[info]: OmniSharp.WorkspaceInitializer
        Configuration finished.
[info]: OmniSharp.Stdio.Host
        Omnisharp server running using Stdio at location '/home/solrevdev/Code/scratch/testconsole' on host 8306.
[warn]: OmniSharp.MSBuild.ProjectManager
        Failed to load project file '/home/solrevdev/Code/scratch/testconsole/testconsole.csproj'.
/home/solrevdev/Code/scratch/testconsole/testconsole.csproj(1,1)
Microsoft.Build.Exceptions.InvalidProjectFileException: The imported project "/usr/lib/mono/xbuild/15.0/Microsoft.Common.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.  /usr/share/dotnet/sdk/2.2.101/Sdks/Microsoft.NET.Sdk/Sdk/Sdk.props
  at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject (System.String errorSubCategoryResourceName, Microsoft.Build.Shared.IElementLocation elementLocation, System.String resourceName, System.Object[] args) [0x00040] in <4e0a1f1d78cf4c1ebd6f9a3dbcebf3bb>: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 <4e0a1f1d78cf4c1ebd6f9a3dbcebf3bb>:0 
  at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject[T1] (Microsoft.Build.Shared.IElementLocation elementLocation, System.String resourceName, T1 arg0) [0x00000] in <4e0a1f1d78cf4c1ebd6f9a3dbcebf3bb>:0 
  at Microsoft.Build.Evaluation.Evaluator`4[P,I,M,D].ExpandAndLoadImportsFromUnescapedImportExpression (System.String directoryOfImportingFile, Microsoft.Build.Construction.ProjectImportElement importElement, System.String unescapedExpression, System.Boolean throwOnFileNotExistsError, System.Collections.Generic.List`1[Microsoft.Build.Construction.ProjectRootElement]& imports) [0x005fb] in <4e0a1f1d78cf4c1ebd6f9a3dbcebf3bb>: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, Microsoft.Build.BackEnd.SdkResolution.SdkResult& sdkResult, System.Boolean throwOnFileNotExistsError) [0x00262] in <4e0a1f1d78cf4c1ebd6f9a3dbcebf3bb>:0 
  at Microsoft.Build.Evaluation.Evaluator`4[P,I,M,D].ExpandAndLoadImports (System.String directoryOfImportingFile, Microsoft.Build.Construction.ProjectImportElement importElement, Microsoft.Build.BackEnd.SdkResolution.SdkResult& sdkResult) [0x00027] in <4e0a1f1d78cf4c1ebd6f9a3dbcebf3bb>:0 
  at Microsoft.Build.Evaluation.Evaluator`4[P,I,M,D].EvaluateImportElement (System.String directoryOfImportingFile, Microsoft.Build.Construction.ProjectImportElement importElement) [0x0000d] in <4e0a1f1d78cf4c1ebd6f9a3dbcebf3bb>:0 
  at Microsoft.Build.Evaluation.Evaluator`4[P,I,M,D].PerformDepthFirstPass (Microsoft.Build.Construction.ProjectRootElement currentProjectOrImport) [0x00209] in <4e0a1f1d78cf4c1ebd6f9a3dbcebf3bb>:0 
  at Microsoft.Build.Evaluation.Evaluator`4[P,I,M,D].EvaluateImportElement (System.String directoryOfImportingFile, Microsoft.Build.Construction.ProjectImportElement importElement) [0x00040] in <4e0a1f1d78cf4c1ebd6f9a3dbcebf3bb>:0 
  at Microsoft.Build.Evaluation.Evaluator`4[P,I,M,D].PerformDepthFirstPass (Microsoft.Build.Construction.ProjectRootElement currentProjectOrImport) [0x000e6] in <4e0a1f1d78cf4c1ebd6f9a3dbcebf3bb>: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 <4e0a1f1d78cf4c1ebd6f9a3dbcebf3bb>: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.BackEnd.SdkResolution.ISdkResolverService sdkResolverService, System.Int32 submissionId, Microsoft.Build.Evaluation.Context.EvaluationContext evaluationContext) [0x0002d] in <4e0a1f1d78cf4c1ebd6f9a3dbcebf3bb>:0 
  at Microsoft.Build.Evaluation.Project.Reevaluate (Microsoft.Build.BackEnd.Logging.ILoggingService loggingServiceForEvaluation, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings, Microsoft.Build.Evaluation.Context.EvaluationContext evaluationContext) [0x0005e] in <4e0a1f1d78cf4c1ebd6f9a3dbcebf3bb>:0 
  at Microsoft.Build.Evaluation.Project.ReevaluateIfNecessary (Microsoft.Build.BackEnd.Logging.ILoggingService loggingServiceForEvaluation, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings, Microsoft.Build.Evaluation.Context.EvaluationContext evaluationContext) [0x00035] in <4e0a1f1d78cf4c1ebd6f9a3dbcebf3bb>:0 
  at Microsoft.Build.Evaluation.Project.ReevaluateIfNecessary (Microsoft.Build.BackEnd.Logging.ILoggingService loggingServiceForEvaluation, Microsoft.Build.Evaluation.Context.EvaluationContext evaluationContext) [0x00000] in <4e0a1f1d78cf4c1ebd6f9a3dbcebf3bb>:0 
  at Microsoft.Build.Evaluation.Project.ReevaluateIfNecessary (Microsoft.Build.Evaluation.Context.EvaluationContext evaluationContext) [0x00007] in <4e0a1f1d78cf4c1ebd6f9a3dbcebf3bb>: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 <4e0a1f1d78cf4c1ebd6f9a3dbcebf3bb>: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) [0x00093] in <4e0a1f1d78cf4c1ebd6f9a3dbcebf3bb>: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 <4e0a1f1d78cf4c1ebd6f9a3dbcebf3bb>: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 <4e0a1f1d78cf4c1ebd6f9a3dbcebf3bb>: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 <4e0a1f1d78cf4c1ebd6f9a3dbcebf3bb>:0 
  at Microsoft.Build.Evaluation.ProjectCollection.LoadProject (System.String fileName, System.Collections.Generic.IDictionary`2[TKey,TValue] globalProperties, System.String toolsVersion) [0x000f7] in <4e0a1f1d78cf4c1ebd6f9a3dbcebf3bb>:0 
  at Microsoft.Build.Evaluation.ProjectCollection.LoadProject (System.String fileName, System.String toolsVersion) [0x00000] in <4e0a1f1d78cf4c1ebd6f9a3dbcebf3bb>:0 
  at OmniSharp.MSBuild.ProjectLoader.EvaluateProjectFileCore (System.String filePath) [0x0003f] in <eb2301968545414ba8ba2559953cdd18>:0 
  at OmniSharp.MSBuild.ProjectLoader.BuildProject (System.String filePath) [0x0000d] in <eb2301968545414ba8ba2559953cdd18>:0 
  at OmniSharp.MSBuild.ProjectFile.ProjectFileInfo.Load (System.String filePath, OmniSharp.MSBuild.ProjectIdInfo projectIdInfo, OmniSharp.MSBuild.ProjectLoader loader) [0x00015] in <eb2301968545414ba8ba2559953cdd18>:0 
  at OmniSharp.MSBuild.ProjectManager+<>c__DisplayClass31_0.<LoadProject>b__0 () [0x00000] in <eb2301968545414ba8ba2559953cdd18>:0 
  at (wrapper delegate-invoke) System.Func`1[System.ValueTuple`3[OmniSharp.MSBuild.ProjectFile.ProjectFileInfo,System.Collections.Immutable.ImmutableArray`1[OmniSharp.MSBuild.Logging.MSBuildDiagnostic],OmniSharp.MSBuild.Notification.ProjectLoadedEventArgs]].invoke_TResult()
  at OmniSharp.MSBuild.ProjectManager.LoadOrReloadProject (System.String projectFilePath, System.Func`1[TResult] loader) [0x0001b] in <eb2301968545414ba8ba2559953cdd18>:0 

[fail]: OmniSharp.MSBuild.ProjectManager
        Attempted to update project that is not loaded: /home/solrevdev/Code/scratch/testconsole/testconsole.csproj

VS Code version: Code - Insiders 1.34.0-insider (473af338e1bd9ad4d9853933da1cd9d5d9e07dc9, 2019-05-01T05:15:04.403Z) OS version: Linux x64 5.0.0-13-generic

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz (4 x 3100)| |GPU Status|2d_canvas: enabled
checker_imaging: disabled_off
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: disabled_software
surface_synchronization: enabled_on
video_decode: unavailable_off
webgl: enabled
webgl2: enabled| |Load (avg)|2, 1, 1| |Memory (System)|7.71GB (1.19GB free)| |Process Argv|--unity-launch| |Screen Reader|no| |VM|0%|
Extensions (66) Extension|Author (truncated)|Version ---|---|--- html-snippets|abu|0.2.1 razor-snippets-for-asp-net-core|ale|0.0.3 atlascode|atl|1.3.0 emojisense|bie|0.5.1 npm-intellisense|chr|1.3.0 path-intellisense|chr|1.4.2 bracket-pair-colorizer|Coe|1.0.61 vscode-eslint|dba|1.8.2 githistory|don|0.4.6 xml|Dot|2.4.0 es7-react-js-snippets|dsz|2.2.2 viml|dun|0.1.7 gitlens|eam|9.7.1 vscode-html-css|ecm|0.2.0 EditorConfig|Edi|0.13.0 vscode-npm-script|eg2|0.3.5 LogFileHighlighter|emi|2.4.3 prettier-vscode|esb|1.9.0 vscode-todo-plus|fab|4.13.0 auto-close-tag|for|0.5.6 auto-rename-tag|for|0.0.15 dotnet-test-explorer|for|0.6.6 shell-format|fox|4.0.11 vscode-pull-request-github|Git|0.6.0 gc-excelviewer|Gra|2.1.32 vscode-trello-viewer|Ho-|0.6.0 rest-client|hum|0.21.2 csharpextensions|jch|1.3.0 nuget-reverse-package-search|jes|0.1.68 vscode-nuget-package-manager|jmr|1.1.6 docomment|k--|0.1.6 chat|kar|0.15.0 vscode-gist|ken|3.0.3 wrapSelection|kon|0.6.8 bash-ide-vscode|mad|1.3.3 identical-sublime-monokai-csharp-theme-colorizer|max|0.11.1 dotenv|mik|1.0.1 python|ms-|2019.4.12954 csharp|ms-|1.19.0 powershell|ms-|1.12.1 vscode-typescript-tslint-plugin|ms-|1.0.0 vsliveshare|ms-|1.0.125 vsliveshare-audio|ms-|0.1.50 vsliveshare-pack|ms-|0.2.12 debugger-for-chrome|msj|4.11.3 editorconfiggenerator|nep|0.2.1 vetur|oct|0.19.5 advanced-new-file|pat|1.2.0 vscode-docker|Pet|0.6.2 polacode|pnp|0.3.0 quicktype|qui|12.0.46 vscode-yaml|red|0.4.0 vscode-sort-json|ric|1.13.0 LiveServer|rit|5.6.1 bash-debug|rog|0.3.4 partial-diff|ryu|1.4.0 code-settings-sync|Sha|3.2.9 msbuild-project-tools|tin|0.2.54 sort-lines|Tyr|1.8.0 vscodeintellicode|Vis|1.1.6 vscode-icons|vsc|8.6.0 vscode-wakatime|Wak|2.0.9 quokka-vscode|Wal|1.0.210 vscode-surround|yat|1.0.2 markdown-all-in-one|yzh|2.3.1 html-css-class-completion|Zig|1.18.0 (1 theme extensions excluded)
dandev486 commented 5 years ago

The reported issue is also perceived with slightly different environment settings. Sharing a summarized version just with the environment differences, in case it helps, to avoid opening a separate issue for what appears to be the same problem. Thank you very much.

OmniSharp.MSBuild.ProjectManager
        Failed to load project file '/home/daniel/Projects/CsTestApp/CsTestApp.csproj'.
/home/daniel/Projects/CsTestApp/CsTestApp.csproj(1,1)
Microsoft.Build.Exceptions.InvalidProjectFileException: The imported project "/usr/lib/mono/xbuild/15.0/Microsoft.Common.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.  /usr/share/dotnet/sdk/2.2.203/Sdks/Microsoft.NET.Sdk/Sdk/Sdk.props

VSCode version: 1.33.1 C# Extension: 1.19.1

Mono Information OmniSharp using global mono :5.18.0
Dotnet Information .NET Core SDK (reflecting any global.json): Version: 2.2.203 Commit: e5bab63eca Runtime Environment: OS Name: ubuntu OS Version: 19.04 OS Platform: Linux RID: linux-x64 Base Path: /usr/share/dotnet/sdk/2.2.203/ Host (useful for support): Version: 2.2.4 Commit: f95848e524 .NET Core SDKs installed: 2.1.603 [/usr/share/dotnet/sdk] 2.2.203 [/usr/share/dotnet/sdk]
hiranya911 commented 5 years ago

This started happening on my development environment too.

Mono JIT compiler version 5.18.0.240 (Debian 5.18.0.240+dfsg-2 Tue Apr 16 02:41:45 UTC 2019)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
    TLS:           __thread
    SIGSEGV:       altstack
    Notifications: epoll
    Architecture:  amd64
    Disabled:      none
    Misc:          softdebug 
    Interpreter:   yes
    LLVM:          supported, not enabled.
    Suspend:       preemptive
    GC:            sgen (concurrent by default)
.NET Core SDK (reflecting any global.json):
 Version:   2.2.203
 Commit:    e5bab63eca

Runtime Environment:
 OS Name:     debian
 OS Version:  
 OS Platform: Linux
 RID:         debian-x64
 Base Path:   /usr/local/google/home/hkj/Software/dotnetsdk-2.2.203/sdk/2.2.203/

Host (useful for support):
  Version: 2.2.4
  Commit:  f95848e524

.NET Core SDKs installed:
  2.2.203 [/usr/local/google/home/hkj/Software/dotnetsdk-2.2.203/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.2.4 [/usr/local/google/home/hkj/Software/dotnetsdk-2.2.203/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.2.4 [/usr/local/google/home/hkj/Software/dotnetsdk-2.2.203/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.2.4 [/usr/local/google/home/hkj/Software/dotnetsdk-2.2.203/shared/Microsoft.NETCore.App]
dandev486 commented 5 years ago

@solrevdev and @hiranya911, just in case you or someone else that view this issue have to do some work that cannot be done otherwise and you have the option of switching to a different operating system, the extension works properly on a fresh install that I've made on my home computer with the environment settings below.

Operating System: Fedora Workstation 30 x86_64 Visual Studio Code: 1.33.1 C# Extension: 1.19.1 Dotnet Core SDK: 2.2.203

In any rate, let's wait for an answer of one of the project mantainers, but maybe the issue isn't related to the extension itself, but with some dependency on which the extension relies, on my work computer the issue started after upgrading from Ubuntu 18.04.2 LTS to Ubuntu 19.04. While investigating the issue I've found out the Microsoft.Commons.props file does exist on the /usr/lib/mono/xbuild/14.0/ folder, but is missing on the /usr/lib/mono/xbuild/15.0/.

hiranya911 commented 5 years ago

Thanks @danieldeveloper001. I'm currently using the same exact versions as you (except it's a different flavor of Linux based on Debian). I've tried re-installing the extension a couple of times to no avail. As you said it might be due to a system dependency.

While investigating the issue I've found out the Microsoft.Commons.props file does exist on the /usr/lib/mono/xbuild/14.0/ folder, but is missing on the /usr/lib/mono/xbuild/15.0/

Yes, I've observed the same in my environment.

For now I can continue my work on my Mac. But I'd love to return to my Linux workstation soon :)

solrevdev commented 5 years ago

So, working without IntelliSense was getting too much for me so I decided to re-install Mono to see if that would add the missing file that seems to be at least part of the exception I was getting.

Running this from my terminal seems to fix it for me. :tada:

sudo apt install gnupg ca-certificates
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb https://download.mono-project.com/repo/ubuntu stable-bionic main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
sudo apt update

sudo apt install mono-devel

I will leave the bug open however as others have had the same issue my fix may not even have anything to do with re-installing mono :man_shrugging:

lonix1 commented 5 years ago

@solrevdev Which version of mono-devel did you install?

I just upgraded to ubuntu 19.04 and I get these errors. My mono-devel is 5.18.0.240.

solrevdev commented 5 years ago

@lonix1

I ran the instructions from the 18.04 version from the mono project page

mono-devel:

apt info mono-devel
Package: mono-devel
Version: 5.20.1.19-0xamarin2+ubuntu1804b1
Priority: optional
Section: cli-mono
Source: mono
Maintainer: Debian Mono Group <pkg-mono-group@lists.alioth.debian.org>
Installed-Size: 105 MB

mono version:

mono --version
Mono JIT compiler version 5.20.1.19 (tarball Thu Apr 11 09:02:17 UTC 2019)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
    TLS:           __thread
    SIGSEGV:       altstack
    Notifications: epoll
    Architecture:  amd64
    Disabled:      none
    Misc:          softdebug 
    Interpreter:   yes
    LLVM:          yes(600)
    Suspend:       hybrid
    GC:            sgen (concurrent by default)
lonix1 commented 5 years ago

Yeah that helped, thanks! There was a difference between the mono installed by vscode/omnisharp and the one from the official repo.

The official version fixed it.

solrevdev commented 5 years ago

I’ve just read a similar issue that suggests that omnisharp shouldn’t be using the msbuild assets from mono and should be using the dotnet sdk version instead.

That makes sense to me. So reinstalling mono while apparently working may not be the top solution.

I may try using this command at some point but for now as I said everything seems to work ok.

HTH

lonix1 commented 5 years ago

I agree it's not perfect... but after so much downtime, I'm just glad I got the tools to work. Everything on linux is difficult or buggy, so I'm just happy to get back to coding. Thanks again for your help.

dandev486 commented 5 years ago

@lonix1, keep in mind that many open source projects are maintained by nice teams that choose to make their code open source (and often free) instead closed source (and often paid) model and yet they do such awesome and valuable tools :wink:

Even though your frustration is understandable, statements such as "everything on linux is difficult or buggy" can be a little bit harsh on the project mantainers (and on the Linux project mantainers itself). Please, do not read this as if it was intended to be disrespectful or something, because it is really not :slightly_smiling_face:

Best regards.

lonix1 commented 5 years ago

@danieldeveloper001 If it was not meant to be disrespectful then you should not have said it. :wink: The Microsoft guys are big boys, they can defend themselves.

It didn't cross my mind for one moment that my comment could have been misconstrued as an attack on the Microsoft people, who are giving us (great) software for free.

It was a general comment, borne of frustration, and accurate... and I repeat, "everything in linux is difficult or buggy". I choose to use linux anyway for various reasons. People are so touchy these days, sheesh.

Best regards.

rchande commented 5 years ago

Hey all, sorry for the delay in response here. It sounds like folks were able to unblock themselves by installing mono/mono-devel for their respective distributions?

solrevdev commented 5 years ago

@rchande Yes, I'm all good now thanks.

One quick question though.

Is the correct behaviour to look for mono assets such as the missing "mono/xbuild/15.0/Microsoft.Common.props" file or should it be looking at a donetcore sdk path?

I only ask because I read it elsewhere as a fix for the issue. Otherwise, all is good and I'll close this issue if that helps.

lonix1 commented 5 years ago

@rchande Yes, thanks I'm good too. Official mono-devel did the trick on ubuntu 19.10!

dandev486 commented 5 years ago

@rchande, unblocked, not by manually upgrading mono but by switching to another computer with a distribution that possibly packages a working version of mono - and that's fine to me, thank you for your time and attention to this issue!

@solrevdev pointed out and it is also a doubt of mine, is it the correct behaviour - look for mono - or should it look just for dotnetcore?

akshita31 commented 5 years ago

You could also try setting omnisharp.useGlobalMono: never. This way you will always use the mono that is shipped with omnisharp and is supposed to have all the right bits in place.

@danieldeveloper001 Since omnisharp needs to support dotnet framework projects as well, we cannot easily switch to dotnet core and hence on Linux we need a mono installation.

akshita31 commented 5 years ago

For anyone hitting the issue please update mono or try the setting as mentioned in the above comment.

I will close this issue for now. Please reopen if it reoccurs.

guy-rouillier commented 5 years ago

I'm stuck on this issue with Ubuntu 19.04. I tried setting omnisharp.useGlobalMono: never (for those wondering where you do this, there is a setting in VS Code.) Did not help. I tried complete uninstalling and reinstalling Mono. That didn't help either.

What worked for me was installing VS code from this Microsoft site:

https://code.visualstudio.com/docs/setup/linux

Do not install from the snap store, that will just put you right back into this problem. Instead, scroll down to "Debian and Ubuntu based distributions", and install from the supplied .deb file.

Ok, this bugged me, so I kept going to figure out what the problem was for dotnet installed from the Ubuntu repositories. I found that making the following change corrected the problem.

In /usr/share/dotnet/sdk/2.2.301/Sdks/Microsoft.NET.Sdk/Sdk/Sdk.props: Change <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" /> to <Import Project="/usr/share/dotnet/sdk/2.2.301/Current/Microsoft.Common.props" />

The original produces "The imported project "/usr/lib/mono/xbuild/15.0/Microsoft.Common.props" was not found." which is true that file does not exist. But OmniSharp should not be trying to use that path, since I instructed it (via Settings) to UseGlobalMono=Never. Since I could not reopen this current issue, I created a new one to address this issue with OmniSharp

https://github.com/OmniSharp/omnisharp-vscode/issues/3180

xcaptain commented 5 years ago

I'm having the same issue, I think it's because the conflict between dotnet core and mono, after I uninstalled mono related packages, every thing goes well, I'm using archlinux, so you can try

sudo pacman -R mono mono-tools gtk-sharp-2 msbuild-stable fsharp
hiranya911 commented 5 years ago

@guy-rouillier's solution worked for me as well. Thanks 👍

filipbekic01 commented 5 years ago

I'm stuck on this issue with Ubuntu 19.04. I tried setting omnisharp.useGlobalMono: never (for those wondering where you do this, there is a setting in VS Code.) Did not help. I tried complete uninstalling and reinstalling Mono. That didn't help either.

What worked for me was installing VS code from this Microsoft site:

https://code.visualstudio.com/docs/setup/linux

Do not install from the snap store, that will just put you right back into this problem. Instead, scroll down to "Debian and Ubuntu based distributions", and install from the supplied .deb file.

Ok, this bugged me, so I kept going to figure out what the problem was for dotnet installed from the Ubuntu repositories. I found that making the following change corrected the problem.

In /usr/share/dotnet/sdk/2.2.301/Sdks/Microsoft.NET.Sdk/Sdk/Sdk.props: Change <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" /> to <Import Project="/usr/share/dotnet/sdk/2.2.301/Current/Microsoft.Common.props" />

The original produces "The imported project "/usr/lib/mono/xbuild/15.0/Microsoft.Common.props" was not found." which is true that file does not exist. But OmniSharp should not be trying to use that path, since I instructed it (via Settings) to UseGlobalMono=Never. Since I could not reopen this current issue, I created a new one to address this issue with OmniSharp

3180

This is valid workaround, thank you man!

noobshubham commented 3 years ago

`Starting OmniSharp server at 5/2/2021, 5:20:45 pm Target: c:\Users\This PC\Documents\VS Code - Programs!

OmniSharp server started Path: c:\Users\This PC.vscode\extensions\ms-vscode.csharp-1.15.2.omnisharp\1.37.7-beta.16\OmniSharp.exe PID: 7812

    Starting OmniSharp on Windows 6.2.9200.0 (x64)
    DotNetPath set to dotnet
    Located 1 MSBuild instance(s)
        1: StandAlone 16.8.0 - "c:\Users\This PC\.vscode\extensions\ms-vscode.csharp-1.15.2\.omnisharp\1.37.7-beta.16\.msbuild\Current\Bin"
    MSBUILD_EXE_PATH environment variable set to 'c:\Users\This PC\.vscode\extensions\ms-vscode.csharp-1.15.2\.omnisharp\1.37.7-beta.16\.msbuild\Current\Bin\MSBuild.exe'
    Registered MSBuild instance: StandAlone 16.8.0 - "c:\Users\This PC\.vscode\extensions\ms-vscode.csharp-1.15.2\.omnisharp\1.37.7-beta.16\.msbuild\Current\Bin"
        CscToolExe = csc.exe
        CscToolPath = c:\Users\This PC\.vscode\extensions\ms-vscode.csharp-1.15.2\.omnisharp\1.37.7-beta.16\.msbuild\Current\Bin\Roslyn
        MSBuildExtensionsPath = c:\Users\This PC\.vscode\extensions\ms-vscode.csharp-1.15.2\.omnisharp\1.37.7-beta.16\.msbuild
        MSBuildToolsPath = c:\Users\This PC\.vscode\extensions\ms-vscode.csharp-1.15.2\.omnisharp\1.37.7-beta.16\.msbuild\Current\Bin
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.Completion.CompletionOptionsProvider, Order: 0
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider, Order: 100
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.ImplementTypeWorkspaceOptionsProvider, Order: 110
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.BlockStructureWorkspaceOptionsProvider, Order: 140
    Detecting Cake files in 'c:\Users\This PC\Documents\VS Code - Programs!'.
    Could not find any Cake files
    No solution files found in 'c:\Users\This PC\Documents\VS Code - Programs!'
    Queue project update for 'c:\Users\This PC\Documents\VS Code - Programs!\csharp\csharp.csproj'
    Detecting CSX files in 'c:\Users\This PC\Documents\VS Code - Programs!'.
    Could not find any CSX files
    Configuration finished.
    Omnisharp server running using Stdio at location 'c:\Users\This PC\Documents\VS Code - Programs!' on host 8108.
    Loading project: c:\Users\This PC\Documents\VS Code - Programs!\csharp\csharp.csproj
    Failed to load project file 'c:\Users\This PC\Documents\VS Code - Programs!\csharp\csharp.csproj'.

c:\Users\This PC\Documents\VS Code - Programs!\csharp\csharp.csproj(1,1) Microsoft.Build.Exceptions.InvalidProjectFileException: An unexpected token "s" was found at character position 84 in condition "'$(ImportByWildcardBeforeMicrosoftCommonProps)' == 'true' and exists('c:\Users\This PC.vscode\extensions\ms-vscode.csharp-1.15.2.omnisharp\1.37.7-beta.16.msbuild\$(MSBuildToolsVersion)\Imports\Microsoft.Common.props\ImportBefore')". c:\Users\This PC.vscode\extensions\ms-vscode.csharp-1.15.2.omnisharp\1.37.7-beta.16.msbuild\Current\Microsoft.Common.props at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject(String errorSubCategoryResourceName, IElementLocation elementLocation, String resourceName, Object[] args) at Microsoft.Build.Evaluation.Parser.Factor(String expression) at Microsoft.Build.Evaluation.Parser.RelationalExpr(String expression) at Microsoft.Build.Evaluation.Parser.BooleanTermPrime(String expression, GenericExpressionNode lhs) at Microsoft.Build.Evaluation.Parser.BooleanTerm(String expression) at Microsoft.Build.Evaluation.Parser.Expr(String expression) at Microsoft.Build.Evaluation.Parser.Parse(String expression, ParserOptions optionSettings, ElementLocation elementLocation) at Microsoft.Build.Evaluation.ConditionEvaluator.EvaluateConditionCollectingConditionedProperties[P,I](String condition, ParserOptions options, Expander2 expander, ExpanderOptions expanderOptions, Dictionary2 conditionedPropertiesTable, String evaluationDirectory, ElementLocation elementLocation, ILoggingService loggingServices, BuildEventContext buildEventContext, IFileSystem fileSystem, ProjectRootElementCacheBase projectRootElementCache) at Microsoft.Build.Evaluation.Evaluator4.EvaluateConditionCollectingConditionedProperties(ProjectElement element, String condition, ExpanderOptions expanderOptions, ParserOptions parserOptions, ProjectRootElementCacheBase projectRootElementCache) at Microsoft.Build.Evaluation.Evaluator4.ExpandAndLoadImports(String directoryOfImportingFile, ProjectImportElement importElement, SdkResult& sdkResult) at Microsoft.Build.Evaluation.Evaluator4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement) at Microsoft.Build.Evaluation.Evaluator4.EvaluateImportGroupElement(String directoryOfImportingFile, ProjectImportGroupElement importGroupElement) at Microsoft.Build.Evaluation.Evaluator4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport) at Microsoft.Build.Evaluation.Evaluator4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement) at Microsoft.Build.Evaluation.Evaluator4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport) at Microsoft.Build.Evaluation.Evaluator4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement) at Microsoft.Build.Evaluation.Evaluator4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport) at Microsoft.Build.Evaluation.Evaluator4.Evaluate() at Microsoft.Build.Evaluation.Evaluator4.Evaluate(IEvaluatorData4 data, ProjectRootElement root, ProjectLoadSettings loadSettings, Int32 maxNodeCount, PropertyDictionary1 environmentProperties, ILoggingService loggingService, IItemFactory2 itemFactory, IToolsetProvider toolsetProvider, ProjectRootElementCacheBase projectRootElementCache, BuildEventContext buildEventContext, ISdkResolverService sdkResolverService, Int32 submissionId, EvaluationContext evaluationContext, Boolean interactive) at Microsoft.Build.Evaluation.Project.ProjectImpl.Reevaluate(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext) at Microsoft.Build.Evaluation.Project.ProjectImpl.ReevaluateIfNecessary(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext) at Microsoft.Build.Evaluation.Project.ProjectImpl.ReevaluateIfNecessary(EvaluationContext evaluationContext) at Microsoft.Build.Evaluation.Project.ProjectImpl.Initialize(IDictionary2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext) at Microsoft.Build.Evaluation.Project..ctor(String projectFile, IDictionary2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectCollection projectCollection, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext) at Microsoft.Build.Evaluation.ProjectCollection.LoadProject(String fileName, IDictionary2 globalProperties, String toolsVersion) at OmniSharp.MSBuild.ProjectLoader.EvaluateProjectFileCore(String filePath, IReadOnlyDictionary2 projectConfigurationsInSolution) in D:\a\1\s\src\OmniSharp.MSBuild\ProjectLoader.cs:line 157 at OmniSharp.MSBuild.ProjectLoader.BuildProject(String filePath, IReadOnlyDictionary2 configurationsInSolution) in D:\a\1\s\src\OmniSharp.MSBuild\ProjectLoader.cs:line 75 at OmniSharp.MSBuild.ProjectFile.ProjectFileInfo.Load(String filePath, ProjectIdInfo projectIdInfo, ProjectLoader loader, Guid sessionId, DotNetInfo dotNetInfo) in D:\a\1\s\src\OmniSharp.MSBuild\ProjectFile\ProjectFileInfo.cs:line 116 at OmniSharp.MSBuild.ProjectManager.<>c__DisplayClass31_0.<LoadProject>b__0() in D:\a\1\s\src\OmniSharp.MSBuild\ProjectManager.cs:line 304 at OmniSharp.MSBuild.ProjectManager.LoadOrReloadProject(String projectFilePath, Func1 loader) in D:\a\1\s\src\OmniSharp.MSBuild\ProjectManager.cs:line 315

    Attempted to update project that is not loaded: c:\Users\This PC\Documents\VS Code - Programs!\csharp\csharp.csproj

`

THIS IS FRUSTATING. PLEASE ANYBODY HELP.

guy-rouillier commented 3 years ago

noobshubham, just a guess, but position 84 is the 's' in "This PC" in "exists('c:\Users\This PC.vscode\extensions". Perhaps the space in the path is messing it up. Try using the 8.3 compatible version of the path and see if that helps. Use "dir /x" to determine that.

noobshubham commented 3 years ago

noobshubham, just a guess, but position 84 is the 's' in "This PC" in "exists('c:\Users\This PC.vscode\extensions". Perhaps the space in the path is messing it up. Try using the 8.3 compatible version of the path and see if that helps. Use "dir /x" to determine that.

Thanks for the reply Sir. but i think i'm getting error in C# extension, because it isn't able to generate assests for it!

xmik commented 3 years ago

@noobshubham this solution worked for me. Did you try it? It's in the same Github issue thread. You need to locate the file Microsoft.Common.props first on your system. But your problem may be different, your error is what @guy-rouillier has written:

Failed to load project file 'c:\Users\This PC\Documents\VS Code - Programs!\csharp\csharp.csproj'.
c:\Users\This PC\Documents\VS Code - Programs!\csharp\csharp.csproj(1,1)
Microsoft.Build.Exceptions.InvalidProjectFileException: An unexpected token "s" was found at character position 84 in condition "'$(ImportByWildcardBeforeMicrosoftCommonProps)' == 'true' and exists('c:\Users\This PC.vscode\extensions\ms-vscode.csharp-1.15.2.omnisharp\1.37.7-beta.16.msbuild$(MSBuildToolsVersion)\Imports\Microsoft.Common.props\ImportBefore')". 

Try renaming your directory VS Code - Programs! so that it does not contain exclamation signs, deleting spaces is also a good advice.