【发布时间】: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