dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.87k stars 675 forks source link

globaljson causes this problem, interferes with msbuild #4198

Open wkrea opened 4 years ago

wkrea commented 4 years ago

Some important information

How i´ve discovered the reason.? I just try to opened the project from Visual Studio 2019 community edition, and saw this message Screenshot_4

Thanks a lot for this awesome project, i hope to contribute with this to make this better

Environment data

dotnet --info output:

$ dotnet --info SDK de .NET Core (reflejando cualquier global.json): Version: 3.1.403 Commit: 9e895200cd

Entorno de tiempo de ejecución: OS Name: Windows OS Version: 10.0.18363
OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\3.1.403\

Host (useful for support): Version: 3.1.9 Commit: 774fc3d6a9

.NET Core SDKs installed: 2.2.207 [C:\Program Files\dotnet\sdk] 3.1.300 [C:\Program Files\dotnet\sdk] 3.1.301 [C:\Program Files\dotnet\sdk] 3.1.403 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.19 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.19 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.19 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

VS Code version: >=1.50 C# Extension version: >=1.23.0

OmniSharp log

Starting OmniSharp server at 10/11/2020, 3:45:12 p. m. Target: d:\Desktop\2020-2\GNU3\App.api

OmniSharp server started. Path: c:\Users\asus.vscode\extensions\ms-dotnettools.csharp-1.23.5.omnisharp\1.37.4-beta.22\OmniSharp.exe PID: 20328

Starting OmniSharp on Windows 6.2.9200.0 (x64)

DotNetPath set to dotnet

Located 2 MSBuild instance(s) 1: Visual Studio Community 2019 16.6.30204.135 - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin" 2: StandAlone 16.8.0 - "c:\Users\asus.vscode\extensions\ms-dotnettools.csharp-1.23.5.omnisharp\1.37.4-beta.22.msbuild\Current\Bin"

Registered MSBuild instance: Visual Studio Community 2019 16.6.30204.135 - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin"

Detecting Cake files in 'd:\Desktop\2020-2\GNU3\App.api'.

Could not find any Cake files

No solution files found in 'd:\Desktop\2020-2\GNU3\App.api'

Queue project update for 'd:\Desktop\2020-2\GNU3\App.api\App.api.csproj'

Detecting CSX files in 'd:\Desktop\2020-2\GNU3\App.api'.

Could not find any CSX files

Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0

Loading project: d:\Desktop\2020-2\GNU3\App.api\App.api.csproj

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

Configuration finished.

Omnisharp server running using Stdio at location 'd:\Desktop\2020-2\GNU3\App.api' on host 8896.

[warn]: OmniSharp.MSBuild.ProjectManager Failed to load project file 'd:\Desktop\2020-2\GNU3\App.api\App.api.csproj'. d:\Desktop\2020-2\GNU3\App.api\App.api.csproj(1,1) Microsoft.Build.Exceptions.InvalidProjectFileException: El SDK "Microsoft.NET.Sdk.Web" especificado no se pudo encontrar. d:\Desktop\2020-2\GNU3\App.api\App.api.csproj

en Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject(String errorSubCategoryResourceName, IElementLocation elementLocation, String resourceName, Object[] args) en Microsoft.Build.Evaluation.Evaluator4.ExpandAndLoadImportsFromUnescapedImportExpressionConditioned(String directoryOfImportingFile, ProjectImportElement importElement, List1& projects, SdkResult& sdkResult, Boolean throwOnFileNotExistsError) en Microsoft.Build.Evaluation.Evaluator4.ExpandAndLoadImports(String directoryOfImportingFile, ProjectImportElement importElement, SdkResult& sdkResult) en Microsoft.Build.Evaluation.Evaluator4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement) en Microsoft.Build.Evaluation.Evaluator4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport) en Microsoft.Build.Evaluation.Evaluator4.Evaluate() en 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) en Microsoft.Build.Evaluation.Project.ProjectImpl.Reevaluate(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext) en Microsoft.Build.Evaluation.Project.ProjectImpl.ReevaluateIfNecessary(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext) en Microsoft.Build.Evaluation.Project.ProjectImpl.ReevaluateIfNecessary(EvaluationContext evaluationContext) en Microsoft.Build.Evaluation.Project.ProjectImpl.Initialize(IDictionary2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext) en Microsoft.Build.Evaluation.Project..ctor(String projectFile, IDictionary2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectCollection projectCollection, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext) en Microsoft.Build.Evaluation.ProjectCollection.LoadProject(String fileName, IDictionary2 globalProperties, String toolsVersion) en OmniSharp.MSBuild.ProjectLoader.EvaluateProjectFileCore(String filePath, IReadOnlyDictionary2 projectConfigurationsInSolution) en D:\a\1\s\src\OmniSharp.MSBuild\ProjectLoader.cs:línea 157 en OmniSharp.MSBuild.ProjectLoader.BuildProject(String filePath, IReadOnlyDictionary2 configurationsInSolution) en D:\a\1\s\src\OmniSharp.MSBuild\ProjectLoader.cs:línea 75 en OmniSharp.MSBuild.ProjectFile.ProjectFileInfo.Load(String filePath, ProjectIdInfo projectIdInfo, ProjectLoader loader, Guid sessionId, DotNetInfo dotNetInfo) en D:\a\1\s\src\OmniSharp.MSBuild\ProjectFile\ProjectFileInfo.cs:línea 116 en OmniSharp.MSBuild.ProjectManager.<>c__DisplayClass31_0.<LoadProject>b__0() en D:\a\1\s\src\OmniSharp.MSBuild\ProjectManager.cs:línea 302 en OmniSharp.MSBuild.ProjectManager.LoadOrReloadProject(String projectFilePath, Func1 loader) en D:\a\1\s\src\OmniSharp.MSBuild\ProjectManager.cs:línea 313

Attempted to update project that is not loaded: d:\Desktop\2020-2\GNU3\App.api\App.api.csproj

Solution initialized -> queue all documents for code analysis. Initial document count: 0.

Steps to reproduce

Open webapi netcore project created from command line with vscode

Microsoft.Build.Exceptions.InvalidProjectFileException: El SDK "Microsoft.NET.Sdk.Web" especificado no se pudo encontrar.

Expected behavior

That Omnisharp work as expected, as autocompletion or suggestion for reverse search for nugget packages

Actual behavior

Autocompletion for C# doesn't works

JoeRobich commented 4 years ago

@wkrea Sorry you are running into issues. Please see this note about using .NET Core 3.1.40x SDKs - https://github.com/OmniSharp/omnisharp-vscode#note-about-using-net-core-3140x-sdks. The issue you are running into seems to be that you have VS 16.6 installed but the .NET Core 3.1.40x SDKs require VS 16.7 or higher.