VSCode的Microsoft C#扩展找不到.NET Core SDK OmniSharp日志 C#日志

问题说明

我安装了.NET Core 3.1.0 SDK,试图将microsoft C#扩展名添加到VSCode并得到以下弹出窗口:

VSCode的Microsoft C#扩展找不到.NET Core SDK
      
     OmniSharp日志 C#日志

我很确定我已经正确安装了所有东西。困扰了很长时间之后,我尝试按照here列出的步骤卸载计算机上的所有SDK和运行时。重新安装SDK 3.1.0,问题仍然存在。

复制步骤

由于这似乎是一个罕见的问题,因此不确定如何重现!第一次发生此问题时,我确实在计算机上安装了VS Community,但此后我将其和所有相关的SDK卸载了,但问题仍然存在。

预期行为

为了使扩展程序能够找到SDK,因为我可以从终端运行所有dotnet命令。

实际行为

找不到它。

日志

OmniSharp日志

<details>Starting OmniSharp server at 1/11/2020,12:55:00 PM
    Target: /Users/finley/dev/dotnet/DatingApp/DatingApp.API

OmniSharp server started.
    Path: /Users/finley/.vscode/extensions/ms-vscode.csharp-1.21.9/.omnisharp/1.34.9/run
    PID: 3072

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on MacOS 10.15.2 (x64)
[info]: OmniSharp.Services.DotNetCliService
        DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 1 MSBuild instance(s)
            1: StandAlone 16.3 - "/Users/finley/.vscode/extensions/ms-vscode.csharp-1.21.9/.omnisharp/1.34.9/omnisharp/.msbuild/Current/Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        MSBUILD_EXE_PATH environment variable set to '/Users/finley/.vscode/extensions/ms-vscode.csharp-1.21.9/.omnisharp/1.34.9/omnisharp/.msbuild/Current/Bin/MSBuild.dll'
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: StandAlone 16.3 - "/Users/finley/.vscode/extensions/ms-vscode.csharp-1.21.9/.omnisharp/1.34.9/omnisharp/.msbuild/Current/Bin"
            CscToolExe = csc.exe
            MSBuildToolsPath = /Users/finley/.vscode/extensions/ms-vscode.csharp-1.21.9/.omnisharp/1.34.9/omnisharp/.msbuild/Current/Bin
            CscToolPath = /Users/finley/.vscode/extensions/ms-vscode.csharp-1.21.9/.omnisharp/1.34.9/omnisharp/.msbuild/Current/Bin/Roslyn
            BypassFrameworkInstallChecks = true
            MSBuildExtensionsPath = /Users/finley/.vscode/extensions/ms-vscode.csharp-1.21.9/.omnisharp/1.34.9/omnisharp/.msbuild
[info]: OmniSharp.Cake.CakeProjectSystem
        Detecting Cake files in '/Users/finley/dev/dotnet/DatingApp/DatingApp.API'.
[info]: OmniSharp.Cake.CakeProjectSystem
        Could not find any Cake files
[info]: OmniSharp.MSBuild.ProjectSystem
        No solution files found in '/Users/finley/dev/dotnet/DatingApp/DatingApp.API'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for '/Users/finley/dev/dotnet/DatingApp/DatingApp.API/DatingApp.API.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in '/Users/finley/dev/dotnet/DatingApp/DatingApp.API'.
[info]: OmniSharp.Script.ScriptProjectSystem
        Could not find any CSX files
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider,Order: 0
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider,Order: 100
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.EditorConfigWorkspaceOptionsProvider,Order: 200
[info]: OmniSharp.WorkspaceInitializer
        Configuration finished.
[info]: OmniSharp.Stdio.Host
        Omnisharp server running using Stdio at location '/Users/finley/dev/dotnet/DatingApp/DatingApp.API' on host 2959.
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: /Users/finley/dev/dotnet/DatingApp/DatingApp.API/DatingApp.API.csproj
  It was not possible to find any installed .NET Core SDKs
  Did you mean to run .NET Core SDK commands? Install a .NET Core SDK from:
      https://aka.ms/dotnet-download
[warn]: OmniSharp.MSBuild.ProjectManager
        Failed to load project file '/Users/finley/dev/dotnet/DatingApp/DatingApp.API/DatingApp.API.csproj'.
/Users/finley/dev/dotnet/DatingApp/DatingApp.API/DatingApp.API.csproj(1,1)
microsoft.build.Exceptions.InvalidProjectFileException: The SDK 'microsoft.NET.Sdk.Web' specified could not be found.  /Users/finley/dev/dotnet/DatingApp/DatingApp.API/DatingApp.API.csproj
  at microsoft.build.Shared.ProjectErrorUtilities.ThrowInvalidProject (System.String errorSubCategoryResourceName,microsoft.build.Shared.IElementLocation elementLocation,System.String resourceName,System.Object[] args) [0x00040] in <10b73e4bf233421cae439ef765e97ef0>:0 
  at microsoft.build.Shared.ProjectErrorUtilities.VerifyThrowInvalidProject[T1] (System.Boolean condition,System.String errorSubCategoryResourceName,T1 arg0) [0x00003] in <10b73e4bf233421cae439ef765e97ef0>:0 
  at microsoft.build.Shared.ProjectErrorUtilities.ThrowInvalidProject[T1] (microsoft.build.Shared.IElementLocation elementLocation,T1 arg0) [0x00000] in <10b73e4bf233421cae439ef765e97ef0>: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) [0x00254] in <10b73e4bf233421cae439ef765e97ef0>:0 
  at microsoft.build.Evaluation.Evaluator`4[P,D].ExpandAndLoadImports (System.String directoryOfImportingFile,microsoft.build.BackEnd.SdkResolution.SdkResult& sdkResult) [0x00027] in <10b73e4bf233421cae439ef765e97ef0>:0 
  at microsoft.build.Evaluation.Evaluator`4[P,D].EvaluateImportElement (System.String directoryOfImportingFile,microsoft.build.Construction.ProjectImportElement importElement) [0x0000d] in <10b73e4bf233421cae439ef765e97ef0>:0 
  at microsoft.build.Evaluation.Evaluator`4[P,D].PerformDepthFirstPass (microsoft.build.Construction.ProjectRootElement currentProjectOrImport) [0x000e6] in <10b73e4bf233421cae439ef765e97ef0>:0 
  at microsoft.build.Evaluation.Evaluator`4[P,D].Evaluate (microsoft.build.BackEnd.Logging.ILoggingService loggingService,microsoft.build.Framework.BuildEventContext buildEventContext) [0x0011c] in <10b73e4bf233421cae439ef765e97ef0>:0 
  at microsoft.build.Evaluation.Evaluator`4[P,D].Evaluate (microsoft.build.Evaluation.IEvaluatordata`4[P,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.ProjectRootElementCacheBase projectRootElementCache,microsoft.build.Framework.BuildEventContext buildEventContext,microsoft.build.BackEnd.SdkResolution.ISdkResolverService sdkResolverService,System.Int32 submissionId,microsoft.build.Evaluation.Context.EvaluationContext evaluationContext,System.Boolean interactive) [0x0002f] in <10b73e4bf233421cae439ef765e97ef0>:0 
  at microsoft.build.Evaluation.Project.Reevaluate (microsoft.build.BackEnd.Logging.ILoggingService loggingServiceForEvaluation,microsoft.build.Evaluation.Context.EvaluationContext evaluationContext) [0x0005e] in <10b73e4bf233421cae439ef765e97ef0>:0 
  at microsoft.build.Evaluation.Project.ReevaluateIfNecessary (microsoft.build.BackEnd.Logging.ILoggingService loggingServiceForEvaluation,microsoft.build.Evaluation.Context.EvaluationContext evaluationContext) [0x00035] in <10b73e4bf233421cae439ef765e97ef0>:0 
  at microsoft.build.Evaluation.Project.ReevaluateIfNecessary (microsoft.build.BackEnd.Logging.ILoggingService loggingServiceForEvaluation,microsoft.build.Evaluation.Context.EvaluationContext evaluationContext) [0x00000] in <10b73e4bf233421cae439ef765e97ef0>:0 
  at microsoft.build.Evaluation.Project.ReevaluateIfNecessary (microsoft.build.Evaluation.Context.EvaluationContext evaluationContext) [0x00007] in <10b73e4bf233421cae439ef765e97ef0>:0 
  at microsoft.build.Evaluation.Project.Initialize (System.Collections.Generic.IDictionary`2[TKey,tvalue] globalProperties,System.String toolsVersion,System.String subToolsetVersion,microsoft.build.Evaluation.Context.EvaluationContext evaluationContext) [0x00126] in <10b73e4bf233421cae439ef765e97ef0>:0 
  at microsoft.build.Evaluation.Project..ctor (System.String projectFile,System.Collections.Generic.IDictionary`2[TKey,microsoft.build.Evaluation.ProjectCollection projectCollection,microsoft.build.Evaluation.Context.EvaluationContext evaluationContext) [0x00093] in <10b73e4bf233421cae439ef765e97ef0>:0 
  at microsoft.build.Evaluation.Project..ctor (System.String projectFile,microsoft.build.Evaluation.ProjectLoadSettings loadSettings) [0x00000] in <10b73e4bf233421cae439ef765e97ef0>:0 
  at microsoft.build.Evaluation.Project..ctor (System.String projectFile,microsoft.build.Evaluation.ProjectCollection projectCollection) [0x00000] in <10b73e4bf233421cae439ef765e97ef0>:0 
  at microsoft.build.Evaluation.ProjectCollection.LoadProject (System.String fileName,System.String toolsVersion) [0x000f7] in <10b73e4bf233421cae439ef765e97ef0>:0 
  at microsoft.build.Evaluation.ProjectCollection.LoadProject (System.String fileName,System.String toolsVersion) [0x00000] in <10b73e4bf233421cae439ef765e97ef0>:0 
  at OmniSharp.MSBuild.ProjectLoader.EvaluateProjectFileCore (System.String filePath) [0x0003f] in <21e2225264e848eb88f797c7e4a5cc78>:0 
  at OmniSharp.MSBuild.ProjectLoader.BuildProject (System.String filePath) [0x0000d] in <21e2225264e848eb88f797c7e4a5cc78>:0 
  at OmniSharp.MSBuild.ProjectFile.ProjectFileInfo.Load (System.String filePath,OmniSharp.MSBuild.ProjectIdInfo projectIdInfo,OmniSharp.MSBuild.ProjectLoader loader) [0x00015] in <21e2225264e848eb88f797c7e4a5cc78>:0 
  at OmniSharp.MSBuild.ProjectManager+<>c__DisplayClass29_0.<LoadProject>b__0 () [0x00000] in <21e2225264e848eb88f797c7e4a5cc78>: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 <21e2225264e848eb88f797c7e4a5cc78>:0 

[fail]: OmniSharp.MSBuild.ProjectManager
        Attempted to update project that is not loaded: /Users/finley/dev/dotnet/DatingApp/DatingApp.API/DatingApp.API.csproj</details>

C#日志

Installing C# dependencies...
Platform: darwin,x86_64

Downloading package 'OmniSharp for OSX' (44721 KB).................... Done!
Validating download...
Integrity Check succeeded.
Installing package 'OmniSharp for OSX'

Downloading package '.NET Core Debugger (macOS / x64)' (51272 KB).................... Done!
Validating download...
Integrity Check succeeded.
Installing package '.NET Core Debugger (macOS / x64)'

Downloading package 'Razor Language Server (macOS / x64)' (50263 KB).................... Done!
Installing package 'Razor Language Server (macOS / x64)'

Finished

Failed to spawn 'dotnet --info'

环境信息

VSCode版本:1.41.1 C#扩展名:1.21.9

单声道信息

OmniSharp使用内置的单声道

Dotnet信息

找不到有效的dotnet安装。

我的dotnet --info输出:

.NET Core SDK (reflecting any global.json):
 Version:   3.1.100
 Commit:    cd82f021f4

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.15
 OS Platform: Darwin
 RID:         osx.10.15-x64
 Base Path:   /usr/local/share/dotnet/sdk/3.1.100/

Host (useful for support):
  Version: 3.1.0
  Commit:  65f04fb6db

.NET Core SDKs installed:
  3.1.100 [/usr/local/share/dotnet/sdk]

.NET Core runtimes installed:
  microsoft.AspNetCore.App 3.1.0 [/usr/local/share/dotnet/shared/microsoft.AspNetCore.App]
  microsoft.NETCore.App 3.1.0 [/usr/local/share/dotnet/shared/microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download
caoxingxiecan 回答:VSCode的Microsoft C#扩展找不到.NET Core SDK OmniSharp日志 C#日志

这里有两个问题!

  1. 通过快捷方式打开时,VSCode没有权限(?)运行shell命令(代表扩展名?)。

  2. C#扩展生成的路径归root所有(因为我在生成它们时绝望时用sudo打开了VSCode),当从以下位置正常打开时,扩展无法访问该路径: CLI。 我必须删除项目的/ bin和/ obj文件夹才能解决此问题。

希望这对其他人有帮助!

本文链接:https://www.f2er.com/2784798.html

大家都在问