Search code examples
.netvisual-studiodebuggingf#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 decided to create a test F# .NET Core 3.1 project, below is the .csproj file:

<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:

enter image description here

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. For reference, these are my installed components:

enter image description here

What am I missing? Thank you.


Solution

  • 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.