Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
514 views
in Technique[技术] by (71.8m points)

c# - OmniSharp.MSBuild.ProjectManager Attempted to update project that is not loaded:

I started to develop Asp.net Core web API with the VS code. But when I typing the code Intellisense/Suggestions not working properly. I saw in some resource on the internet while they are typing using Microsoft., EntityFrameworkCore showing as a suggestion. But In my case, it's not showing. In the OmniSharp log showing following error to me.

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

OmniSharp server started.
    Path: C:UsersAcer.vscodeextensionsms-vscode.csharp-1.18.0.omnisharp1.32.11OmniSharp.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:UsersAcer.vscodeextensionsms-vscode.csharp-1.18.0.omnisharp1.32.11msbuild15.0Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        MSBUILD_EXE_PATH environment variable set to 'C:UsersAcer.vscodeextensionsms-vscode.csharp-1.18.0.omnisharp1.32.11msbuild15.0BinMSBuild.exe'
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: StandAlone 15.0 - "C:UsersAcer.vscodeextensionsms-vscode.csharp-1.18.0.omnisharp1.32.11msbuild15.0Bin"
            CscToolExe = csc.exe
            CscToolPath = C:UsersAcer.vscodeextensionsms-vscode.csharp-1.18.0.omnisharp1.32.11msbuild15.0BinRoslyn
            MSBuildExtensionsPath = C:UsersAcer.vscodeextensionsms-vscode.csharp-1.18.0.omnisharp1.32.11msbuild
            MSBuildToolsPath = C:UsersAcer.vscodeextensionsms-vscode.csharp-1.18.0.omnisharp1.32.11msbuild15.0Bin
[info]: OmniSharp.Cake.CakeProjectSystem
        Detecting Cake files in 'c:Dotnet CoreNgWebApi'.
[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 CoreNgWebApi'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'c:Dotnet CoreNgWebApiNgWebApi.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in 'c:Dotnet CoreNgWebApi'.
[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 CoreNgWebApiNgWebApi.csproj
[info]: OmniSharp.WorkspaceInitializer
        Configuration finished.
[info]: OmniSharp.Stdio.Host
        Omnisharp server running using Stdio at location 'c:Dotnet CoreNgWebApi' on host 17188.
[warn]: OmniSharp.MSBuild.ProjectManager
        Failed to load project file 'c:Dotnet CoreNgWebApiNgWebApi.csproj'.
c:Dotnet CoreNgWebApiNgWebApi.csproj(1,1)
Microsoft.Build.Exceptions.InvalidProjectFileException: The SDK 'Microsoft.NET.Sdk.Web' specified could not be found.  c:Dotnet CoreNgWebApiNgWebApi.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 CoreNgWebApiNgWebApi.csproj

I re-installed the VS Code and C# , C# Extention to solve this problem, but it's still occurring. I think the reason was to not showing Intellisense/Suggestions the project is not properly loaded. Can anyone tell me how to avoid this error and how to solve Intellisense/Suggestions not showing the issue.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Solved (cross checked on Ubuntu 16.04 and CentOS 7):

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"

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...