简体   繁体   English

Visual Studio 2019:如何为调试器配置默认 CLR?

[英]Visual Studio 2019: how to configure the default CLR for the debugger?

I recently installed Visual Studio 2019 on Windows with .NET 5 and .NET Core 3.1 (I did not install any .NET Framework SDK, but seems to be a dependency of other stuff I installed). I recently installed Visual Studio 2019 on Windows with .NET 5 and .NET Core 3.1 (I did not install any .NET Framework SDK, but seems to be a dependency of other stuff I installed). I decided to create a test F# .NET Core 3.1 project, below is the .csproj file:我决定创建一个测试 F# .NET Core 3.1 项目,下面是.csproj文件:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <Name>FSharpSample</Name>
    <ProjectGuid>{be6b33ca-c77e-49de-af02-5febd314d410}</ProjectGuid>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <EnableUnmanagedDebugging>true</EnableUnmanagedDebugging>
    <RemoteDebugEnabled>false</RemoteDebugEnabled>
    <StartAction>Project</StartAction>
    <EnableSQLServerDebugging>false</EnableSQLServerDebugging>
    <UseVSHostingProcess>true</UseVSHostingProcess>
  </PropertyGroup>
  <ItemGroup>
    <Compile Include="Program.fs" />
  </ItemGroup>
</Project>

The problem is that when I'm trying to start debugging the process using the "Start" button in Visual Studio 2019, I'm getting this error:问题是,当我尝试使用 Visual Studio 2019 中的“开始”按钮开始调试进程时,出现此错误:

在此处输入图像描述

Starting the project without a debugger and attaching a debugger to the running process with the "Managed (.NET Core, .NET 5+) code" options works however.但是,在没有调试器的情况下启动项目并使用“托管(.NET Core,.NET 5+)代码”选项将调试器附加到正在运行的进程是有效的。 For reference, these are my installed components:作为参考,这些是我安装的组件:

在此处输入图像描述

What am I missing?我错过了什么? Thank you.谢谢你。

The solution was to install .NET Desktop Environment feature for Visual Studio 2019. I do not know why it is needed, I thought the SDK would suffice, so please clarify if you know.解决方案是为 Visual Studio 2019 安装 .NET 桌面环境功能。我不知道为什么需要它,我认为 SDK 就足够了,所以如果你知道,请澄清一下。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM