글쓴 사람
        정성태 (techsharer at outlook.com)
        홈페이지
        
        첨부 파일
        
             
        
        
        
            
            
            
                
                    
                    
                    
                    
Visual Studio 2022 - Unable to attach to CoreCLR. The debugger's protocol is incompatible with the debuggee.
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 프로젝트에서는 오류가 발생하지 않습니다.)
[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]
 
        
        
                    
                    
                    
                    
                    
    
                    
                    
                    
                    
                    
                
             
        
        
        
        
        
        
        
            
        
        
        
        
        
        
        ... 151  [152]  153  154  155  156  157  158  159  160  161  162  163  164  165  ...
... 151  [152]  153  154  155  156  157  158  159  160  161  162  163  164  165  ...