gpt4 book ai didi

c# - VS Code 2017 - C# 错误 - "Some projects have trouble loading. Please review the output for more detail"

转载 作者:行者123 更新时间:2023-12-03 22:55:14 26 4
gpt4 key购买 nike

所以我已经根据 Internet 上的教程安装了 C# 扩展和 .Net 以及其他所有内容,我有一个工作区……并且还做了一些其他的事情,比如在终端中输入一些 dotnet 命令。一切正常,没有问题,但是每当我打开脚本/文件时......最初创建的那个 - Program.cs 包含默认的“Hello World!”程序...然后它会显示一条错误消息,指出无法加载项目。但是,当我在终端中编写 dotnet run 时,它的输出没有任何问题。

我在互联网上看到过很多这样的话题,但还没有对我有用。我只是不知道出了什么问题。所以这就是为什么我在这里问这个问题并将错误消息放在这里......这样我就可以知道我的情况出了什么问题。因为我是 VS Code 的新手......并且不知道到底出了什么问题。

这是显示在输出选项卡中的错误消息 -

Starting OmniSharp server at 13/7/2019, 3:46:46 PM
Target: e:\CSharp Workspace

OmniSharp server started.
Path: C:\Users\Arpit Srivastava\.vscode\extensions\ms-vscode.csharp-1.20.0\.omnisharp\1.32.20\OmniSharp.exe
PID: 16516

[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 2 MSBuild instance(s)
1: Visual Studio Community 2017 15.9.28307.222 - "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin"
2: StandAlone 15.0 - "C:\Users\Arpit Srivastava\.vscode\extensions\ms-vscode.csharp-1.20.0\.omnisharp\1.32.20\.msbuild\Current\Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: Visual Studio Community 2017 15.9.28307.222 - "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin"
[info]: OmniSharp.Cake.CakeProjectSystem
Detecting Cake files in 'e:\CSharp Workspace'.
[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 'e:\CSharp Workspace'
[info]: OmniSharp.MSBuild.ProjectManager
Queue project update for 'e:\CSharp Workspace\CSharp Workspace.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
Detecting CSX files in 'e:\CSharp Workspace'.
[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: e:\CSharp Workspace\CSharp Workspace.csproj
[info]: OmniSharp.WorkspaceInitializer
Configuration finished.
[info]: OmniSharp.Stdio.Host
Omnisharp server running using Stdio at location 'e:\CSharp Workspace' on host 7936.
[warn]: OmniSharp.MSBuild.ProjectManager
Failed to load project file 'e:\CSharp Workspace\CSharp Workspace.csproj'.
e:\CSharp Workspace\CSharp Workspace.csproj(1,1)
Microsoft.Build.Exceptions.InvalidProjectFileException: The SDK 'Microsoft.NET.Sdk' specified could not be found. e:\CSharp Workspace\CSharp Workspace.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, SdkResult& sdkResult, Boolean throwOnFileNotExistsError)
at Microsoft.Build.Evaluation.Evaluator`4.ExpandAndLoadImports(String directoryOfImportingFile, ProjectImportElement importElement, SdkResult& sdkResult)
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, EvaluationContext evaluationContext)
at Microsoft.Build.Evaluation.Project.ReevaluateIfNecessary(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
at Microsoft.Build.Evaluation.Project.Initialize(IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
at Microsoft.Build.Evaluation.Project..ctor(String projectFile, IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectCollection projectCollection, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
at Microsoft.Build.Evaluation.ProjectCollection.LoadProject(String fileName, IDictionary`2 globalProperties, String toolsVersion)
at OmniSharp.MSBuild.ProjectLoader.EvaluateProjectFileCore(String filePath) in D:\a\1\s\src\OmniSharp.MSBuild\ProjectLoader.cs:line 129
at OmniSharp.MSBuild.ProjectLoader.BuildProject(String filePath) in D:\a\1\s\src\OmniSharp.MSBuild\ProjectLoader.cs:line 72
at OmniSharp.MSBuild.ProjectFile.ProjectFileInfo.Load(String filePath, ProjectIdInfo projectIdInfo, ProjectLoader loader) in D:\a\1\s\src\OmniSharp.MSBuild\ProjectFile\ProjectFileInfo.cs:line 94
at OmniSharp.MSBuild.ProjectManager.LoadOrReloadProject(String projectFilePath, Func`1 loader) in D:\a\1\s\src\OmniSharp.MSBuild\ProjectManager.cs:line 304

[fail]: OmniSharp.MSBuild.ProjectManager
Attempted to update project that is not loaded: e:\CSharp Workspace\CSharp Workspace.csproj

相反,如果我尝试运行该程序,那么我会在输出中得到这个 -
scriptcs' is not recognized as an internal or external command,
operable program or batch file.

最佳答案

修复此设置 omnisharp.path在 vs 代码设置中为 latest .

  • 转到设置 -> 搜索 omnisharp.path -> 点击 edit in settings.json

  • omnisharp path settings
  • 在 settings.json 中,一直向下滚动到最后一个设置添加一个逗号然后 "omnisharp.path": "latest" -> 保存文件并重新启动 vs 代码以安装最新的 omnisharp(带有修复程序)。
  • 关于c# - VS Code 2017 - C# 错误 - "Some projects have trouble loading. Please review the output for more detail",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57018274/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com