17.4 업데이트 이후 이런 오류는 발생하지 않고 있습니다.
F5 디버깅을 시작했는데, 이런 오류 메시지가 나올 수 있습니다.
Unable to attach to CoreCLR. The debugger's protocol is incompatible with the debuggee.
테스트해보면, RuntimeIdentifier, PublishSingleFile 옵션이 적용된 프로젝트에 대해 그런 오류가 발생합니다.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<PublishSingleFile>true</PublishSingleFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Diagnostics.Runtime" Version="2.2.332302" />
</ItemGroup>
</Project>
어차피 해당 옵션들은 publish 할 때나 사용할 것이므로 그냥 "RuntimeIdentifier" 옵션을 빼고,
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishSingleFile>true</PublishSingleFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Diagnostics.Runtime" Version="2.2.332302" />
</ItemGroup>
</Project>
다음과 같이 publish 빌드 시에 옵션을 전달하는 식으로 처리하시면 됩니다.
dotnet publish /p:RuntimeIdentifier=win-x64
(참고로, 동일한 설정으로 .NET 5 프로젝트에서는 오류가 발생하지 않습니다.)