【问题标题】:How can I fix code folding in Visual Studio Code如何修复 Visual Studio Code 中的代码折叠
【发布时间】:2021-05-09 08:32:41
【问题描述】:

当打开时,Visual Studio Code 会像往常一样在行号旁边显示适当的矢量符号,但是一旦完成加载指示应该能够展开或折叠代码的位置的矢量符号就消失了,并且既没有点击该位置,大纲,快捷键也没有任何作用。矢量和折叠折叠代码的功能消失的同时,右下角出现警告消息“某些项目无法加载。请查看输出以获取更多详细信息。”之前当事情仍然有效时,我也会收到一条错误消息,上面写着“无法启动 MSBuild 语言服务器(有关详细信息,请参阅输出窗口)。”(输出窗口显示:

Starting OmniSharp server at 2/4/2021, 3:58:32 PM\
    Target: d:\Documents\<redacted> Collab\New Macabre Project\New Macabre Project.sln

OmniSharp server started.
    Path: c:\Users\casto\.vscode\extensions\ms-dotnettools.csharp-1.23.8\.omnisharp\1.37.5\OmniSharp.exe
    PID: 40184

[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 Enterprise 2017 15.9.28307.812 - "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin"
            2: StandAlone 16.8.0 - "c:\Users\<redact>\.vscode\extensions\ms-dotnettools.csharp-1.23.8\.omnisharp\1.37.5\.msbuild\Current\Bin"
[warn]: OmniSharp.CompositionHostBuilder
        It looks like you have Visual Studio lower than VS 2019 16.3 installed.
 Try updating Visual Studio to the most recent release to enable better MSBuild support.
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        MSBUILD_EXE_PATH environment variable set to 'c:\Users\<redact>\.vscode\extensions\ms-dotnettools.csharp-1.23.8\.omnisharp\1.37.5\.msbuild\Current\Bin\MSBuild.exe'
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: StandAlone 16.8.0 - "c:\Users\<redact>\.vscode\extensions\ms-dotnettools.csharp-1.23.8\.omnisharp\1.37.5\.msbuild\Current\Bin"
            CscToolExe = csc.exe
            CscToolPath = c:\Users\<redact>\.vscode\extensions\ms-dotnettools.csharp-1.23.8\.omnisharp\1.37.5\.msbuild\Current\Bin\Roslyn
            MSBuildExtensionsPath = c:\Users\<redact>\.vscode\extensions\ms-dotnettools.csharp-1.23.8\.omnisharp\1.37.5\.msbuild
            MSBuildToolsPath = c:\Users\<redact>\.vscode\extensions\ms-dotnettools.csharp-1.23.8\.omnisharp\1.37.5\.msbuild\Current\Bin
[info]: OmniSharp.Cake.CakeProjectSystem
        Detecting Cake files in 'd:\Documents\<redact> Collab\New Macabre Project'.
[info]: OmniSharp.Cake.CakeProjectSystem
        Could not find any Cake files
[info]: OmniSharp.MSBuild.ProjectSystem
        Detecting projects in 'd:\Documents\<redact> Collab\New Macabre Project\New Macabre Project.sln'.
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'd:\Documents\<redact> Collab\New Macabre Project\New Macabre Project.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in 'd:\Documents\<redact> Collab\New Macabre Project'.
[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.MSBuild.ProjectManager
        Loading project: d:\Documents\<redact> Collab\New Macabre Project\New Macabre Project.csproj
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.Completion.CompletionOptionsProvider, 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.ImplementTypeWorkspaceOptionsProvider, Order: 110
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.BlockStructureWorkspaceOptionsProvider, Order: 140
[info]: OmniSharp.WorkspaceInitializer
        Configuration finished.
[info]: OmniSharp.Stdio.Host
        Omnisharp server running using Stdio at location 'd:\Documents\<redact> Collab\New Macabre Project' on host 27768.
[fail]: OmniSharp.MSBuild.ProjectLoader
        The reference assemblies for .NETFramework,Version=v4.7.2 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks
[warn]: OmniSharp.MSBuild.ProjectManager
        Failed to load project file 'd:\Documents\Al Petz Collab\New Macabre Project\New Macabre Project.csproj'.
d:\Documents\<redact> Collab\New Macabre Project\New Macabre Project.csproj
c:\Users\<redact>\.vscode\extensions\ms-dotnettools.csharp-1.23.8\.omnisharp\1.37.5\.msbuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(1180,5): Error: The reference assemblies for .NETFramework,Version=v4.7.2 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks

[fail]: OmniSharp.MSBuild.ProjectManager
        Attempted to update project that is not loaded: d:\Documents\<redact> Collab\New Macabre Project\New Macabre Project.csproj

。)在过去的几个月里,我一直受到 MS 语言构建错误的困扰,虽然这可能会给我带来一些麻烦,但这个代码折叠问题是新的,我无事可做。

【问题讨论】:

  • 您是否尝试过按照输出窗口的建议定位不同版本的 .Net Framework?

标签: visual-studio-code code-folding


【解决方案1】:

看到消息“看起来您安装的 Visual Studio 低于 VS 2019 16.3”。 我尝试谷歌,我找到了this。

但是在您的上下文中并不清楚您在做什么以及您正在构建什么样的软件;请向我们(社区)提供有关您正在创建项目的内容和位置的更多详细信息(例如 Unity 其版本或其他内容)。您可以尝试搜索引擎或您正在使用的框架所需的版本。 请添加有关该项目的更多详细信息。

不同的引擎/程序可能需要不同版本的 开发人员包或“.NET Core 版本”。

这就是为什么我们只能在这种情况下提出建议。

首先,我建议您关闭 IDE 并执行以下步骤:

  1. 转到dotnet.microsoft.com;
  2. 下载开发包.NET Framework 4.8或.NET Framework 4.7.23(下图);
  3. 安装下载的文件,然后重试。

如果它对您没有帮助,您可以尝试将 Visuall Studio 更新到它提示的最新版本。

解决您可能尝试的问题的另一种方法:

  1. 点击顶部菜单中的“构建”;
  2. 点击“清理解决方案”;
  3. 点击“重建解决方案”。

【讨论】:

    猜你喜欢
    • 2018-07-31
    • 2015-09-29
    • 2015-07-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-14
    • 2020-02-01
    相关资源
    最近更新 更多