OmniSharp.MSBuild.ProjectManager尝试更新未加载的项目: - c#

我开始使用VS代码开发Asp.net Core Web API。但是,当我键入代码时,Intellisense / Suggestions无法正常工作。他们在输入using Microsoft.时,我在互联网上的一些资源中看到过,
EntityFrameworkCore显示为建议。但就我而言,它没有显示。在OmniSharp日志中,向我显示以下错误。

Starting OmniSharp server at 4/5/2019, 3:37:16 PM
    Target: c:\Dotnet Core\NgWebApi

OmniSharp server started.
    Path: C:\Users\Acer\.vscode\extensions\ms-vscode.csharp-1.18.0\.omnisharp\1.32.11\OmniSharp.exe
    PID: 13684

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on Windows 6.2.9200.0 (x64)
[info]: OmniSharp.Services.DotNetCliService
        DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 1 MSBuild instance(s)
            1: StandAlone 15.0 - "C:\Users\Acer\.vscode\extensions\ms-vscode.csharp-1.18.0\.omnisharp\1.32.11\msbuild\15.0\Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        MSBUILD_EXE_PATH environment variable set to 'C:\Users\Acer\.vscode\extensions\ms-vscode.csharp-1.18.0\.omnisharp\1.32.11\msbuild\15.0\Bin\MSBuild.exe'
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: StandAlone 15.0 - "C:\Users\Acer\.vscode\extensions\ms-vscode.csharp-1.18.0\.omnisharp\1.32.11\msbuild\15.0\Bin"
            CscToolExe = csc.exe
            CscToolPath = C:\Users\Acer\.vscode\extensions\ms-vscode.csharp-1.18.0\.omnisharp\1.32.11\msbuild\15.0\Bin\Roslyn
            MSBuildExtensionsPath = C:\Users\Acer\.vscode\extensions\ms-vscode.csharp-1.18.0\.omnisharp\1.32.11\msbuild
            MSBuildToolsPath = C:\Users\Acer\.vscode\extensions\ms-vscode.csharp-1.18.0\.omnisharp\1.32.11\msbuild\15.0\Bin
[info]: OmniSharp.Cake.CakeProjectSystem
        Detecting Cake files in 'c:\Dotnet Core\NgWebApi'.
[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 'c:\Dotnet Core\NgWebApi'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'c:\Dotnet Core\NgWebApi\NgWebApi.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in 'c:\Dotnet Core\NgWebApi'.
[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: c:\Dotnet Core\NgWebApi\NgWebApi.csproj
[info]: OmniSharp.WorkspaceInitializer
        Configuration finished.
[info]: OmniSharp.Stdio.Host
        Omnisharp server running using Stdio at location 'c:\Dotnet Core\NgWebApi' on host 17188.
[warn]: OmniSharp.MSBuild.ProjectManager
        Failed to load project file 'c:\Dotnet Core\NgWebApi\NgWebApi.csproj'.
c:\Dotnet Core\NgWebApi\NgWebApi.csproj(1,1)
Microsoft.Build.Exceptions.InvalidProjectFileException: The SDK 'Microsoft.NET.Sdk.Web' specified could not be found.  c:\Dotnet Core\NgWebApi\NgWebApi.csproj
   at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject(String errorSubCategoryResourceName, IElementLocation elementLocation, String resourceName, Object[] args)
   at Microsoft.Build.Evaluation.Evaluator`4.ExpandAndLoadImportsFromUnescapedImportExpressionConditioned(String directoryOfImportingFile, ProjectImportElement importElement, List`1& projects, Boolean throwOnFileNotExistsError)
   at Microsoft.Build.Evaluation.Evaluator`4.ExpandAndLoadImports(String directoryOfImportingFile, ProjectImportElement importElement)
   at Microsoft.Build.Evaluation.Evaluator`4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement)
   at Microsoft.Build.Evaluation.Evaluator`4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport)
   at Microsoft.Build.Evaluation.Evaluator`4.Evaluate(ILoggingService loggingService, BuildEventContext buildEventContext)
   at Microsoft.Build.Evaluation.Project.Reevaluate(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings)
   at Microsoft.Build.Evaluation.Project.ReevaluateIfNecessary(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings)
   at Microsoft.Build.Evaluation.Project.Initialize(IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectLoadSettings loadSettings)
   at Microsoft.Build.Evaluation.Project..ctor(String projectFile, IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectCollection projectCollection, ProjectLoadSettings loadSettings)
   at Microsoft.Build.Evaluation.ProjectCollection.LoadProject(String fileName, IDictionary`2 globalProperties, String toolsVersion)
   at OmniSharp.MSBuild.ProjectLoader.EvaluateProjectFileCore(String filePath)
   at OmniSharp.MSBuild.ProjectLoader.BuildProject(String filePath)
   at OmniSharp.MSBuild.ProjectFile.ProjectFileInfo.Load(String filePath, ProjectLoader loader)
   at OmniSharp.MSBuild.ProjectManager.LoadOrReloadProject(String projectFilePath, Func`1 loader)

[fail]: OmniSharp.MSBuild.ProjectManager
        Attempted to update project that is not loaded: c:\Dotnet Core\NgWebApi\NgWebApi.csproj

我重新安装了VS Code和C#C# Extention来解决此问题,但仍在发生。我认为原因是未显示Intellisense / Suggestions项目未正确加载。谁能告诉我如何避免此错误,以及如何解决未显示此问题的Intellisense /建议。

参考方案

解决(在Ubuntu 16.04和CentOS 7上交叉检查):

在“ VS代码”菜单中,进入“文件” /“首选项” /“设置”。

在“搜索设置”窗口中,键入omnisharp.path

单击“在settings.json中编辑”链接。

像这样添加(或编辑):“ omnisharp.path”:“ latest”

(摘自:https://github.com/OmniSharp/omnisharp-vscode/issues/2965)

'ConfigurationBuilder'不包含'AddJsonFile'的定义 - c#

我有以下错误:Program.cs(15,72):错误CS1061:“ ConfigurationBuilder”不包含“ AddJsonFile”的定义,并且找不到包含“ ConfigurationBuilder”类型的第一个参数的可访问扩展方法“ AddJsonFile”(您是否缺少使用指令或汇编该项目是一个使用Azure Search SDK的dotn…

'聚集'Python中的列表 - python

我一直在尝试“聚集”列表 我的意思是根据它们之间的项目将项目放在一起,因此当“聚集”在任何['d','-','g','p','q','-','a','v','i']周围时,[�…

TypeError:'str'对象不支持项目分配,带有json文件的python - python

以下是我的代码import json with open('johns.json', 'r') as q: l = q.read() data = json.loads(l) data['john'] = '{}' data['john']['use…

R'relaimpo'软件包的Python端口 - python

我需要计算Lindeman-Merenda-Gold(LMG)分数,以进行回归分析。我发现R语言的relaimpo包下有该文件。不幸的是,我对R没有任何经验。我检查了互联网,但找不到。这个程序包有python端口吗?如果不存在,是否可以通过python使用该包? python参考方案 最近,我遇到了pingouin库。

将字符串分配给numpy.zeros数组[重复] - python

This question already has answers here: Weird behaviour initializing a numpy array of string data                                                                    (4个答案)         …