===== .NET Core / .NET5+ 프로그램 원격 디버깅 및 실행 방법 ===== 이 문서는 ComfilePi와 같은 Linux 환경에서 .NET으로 개발된 프로그램을, 원격 설정을 통해 ComfilePi에서 직접 디버깅하고 실행하는 방법을 설명합니다.\\ 이 방식을 사용하면, Visual Studio가 설치된 개발 PC에서 코드를 수정한 후 바로 ComfilePi에서 실행 결과를 확인하며 빠르게 개발할 수 있습니다. * 배포, 실행, 디버그 기능을 원격으로 실행해 가며 사용 할 수 있습니다. * 본문서는 .Net5이상 방법을 설명합니다. * NET Framework 4.x, Mono로 개발시에 FIXME원격모노 디버거 환경설정 방법을 확인하세요. * [[https://learn.microsoft.com/en-us/dotnet/iot/debugging?tabs=self-contained&pivots=visualstudio|기존의 수동적인 방법]] 보다 개선된 방식으로, Visual Studio 2022에서 "F5" 키 입력만으로 ComfilePi에서 디버깅을 수행할 수 있습니다. ===== 설치 및 사양 ===== ^ ^ Date ^ Release Notes ^ | {{ https://downloads.comfiletech.com/ComfilePi/remote_dotnet_debugger/comfiletech.remotedotnetdebugger_v1.5.vsix }} | 2026-01-28 | [[http://www.comfilewiki.co.kr/en/doku.php?id=comfilepi:dotnet_core_development:remote_debugger:release_notes:index|Release Note]] | 위 파일을 다운로드한 후 설치합니다. 설치할 때는 Visual Studio가 실행 중이지 않은 상태여야 합니다. ==== 개발PC ==== * Windows 10 이상, 64비트 * 비주얼 스튜디오 2022 ==== Linux PC(Target PC) ==== * SSH Enable / SSH 인증키 발급 * Installed .NET runtime or SDK[[http://www.comfilewiki.co.kr/en/doku.php?id=comfilepi:dotnet_core_development#install_the_net_sdk_on_the_comfilepi|(설치 방법)]] * vsdbg 설치 ==== 1. SSH 인증키 ==== 보안상의 이유로, Windows에 설치된 "OpenSSH"를 이용한 비밀번호 인증은 허용되지 않습니다.\\ 이러한 이유로, Windows 개발 PC와 ComfilePi(Linux PC)는 원격 장치 간에 Public/Private Key 인증을 사용하여 구성해야 합니다.\\ * Public / Private Key 생성은 OS 이미지 설치 도구인 [[https://www.raspberrypi.com/software/|"Raspberry Pi OS"]]를 이용하여 매우 쉽게 수행할 수 있습니다. * [[http://www.comfilewiki.co.kr/en/doku.php?id=comfilepi:raspbian:index|ComfilePi Os]]를 다운로드 받아[[https://www.raspberrypi.com/software/|"Raspberry Pi OS"]]를 사용하여 Public Key를 생성합니다. * Public Key가 포함된 OS를 ComfilePi에 설치하여 사용합니다. * 인증키 생성 시 Private / Public Key는 Windows 개발 PC에 자동 생성되어 저장됩니다 | {{ :cfnet:remoteprogramming:pi_imager_1.png?nolink |}} | {{ :cfnet:remoteprogramming:pi_imager_2.png?nolink |}} | ※ 더 많은 내용은 [[https://www.raspberrypi.com/documentation/computers/remote-access.html#ssh|Raspberry Pi's documentation ]]에서 확인할 수 있습니다. ==== 2. SSH 인증 확인 ==== 다음 명령어를 이용하여 개발 PC(Windows Pc)와 ComfilePi(Linux Pc)간의 ssh인증을 확인할 수 있습니다. {{ :cfnet:remoteprogramming:test_ssh.mp4?900x506 |}} ==== 3. vsdbg 설치 ==== 원격장치인 ComfilePi(Linux Pc)에는 vsdbg 유틸리티가 설치되 있어야 합니다. 아래와 같이 설치해주세요. - Run ''wget https://aka.ms/getvsdbgsh'' 설치 스크립트를 다운로드합니다. - Run ''chmod +x getvsdbgsh'' 스크립트를 실행 가능하게 만듭니다. - Run ''sudo ./getvsdbgsh -v latest -l /opt/Microsoft/vsdbg'' vsdbg를 설치합니다. 설치 위치는 자유롭게 변경할 수 있으나, 이후 Visual Studio 실행 프로필을 설정할 때 정확한 위치를 기억하고 있어야 합니다. ==== 4. Visual Studio 설정 및 사용 ==== 위 과정을 마친 후,.NET Remote Debugger 실행 구성 프로필을 프로젝트에 추가합니다. 프로필 설정은 “Remote Machine”, “Remote User”, “Path to vsdbg” 만 설정하면 됩니다. * Remote Machine : ComfilePi의 IP 주소 * Remote User : ComfilePi의 User name "pi" * Path to vsdbg : vsdbg 실행 파일의 경로여야 하며, 설치 폴더의 경로가 아닙니다. 예를 들어, vsdbg를 **"/opt/Microsoft/vsdbg"**에 설치한 경우, 실행 파일 경로로는 **"/opt/Microsoft/vsdbg/vsdbg"**를 입력해야 합니다. {{ :cfnet:remoteprogramming:config_launch_profile.mp4?900x608 }} ==== 5. 디버그 확인 ==== 만약 문제가 발생한다면 “Remote .NET Debugger” 확인해 주세요. {{ :cfnet:remoteprogramming:remote_net_debugger_output.png?nolink |}}