Search code examples
visual-studio-coderaspberry-pi

Visual Studio Code / Debugger / Raspberry PI Unable to start debugger


I'm getting this error message from Visual Studio Code when I attempt to run remote debugging (see large screenshot below)

I know this is a version mismatch - but with Visual Studio on 7.0.2, the PI latest version is 6.0.405.

From this screenshot, its saying that version 7.0.2 is not installed - but that version (as far as I know and I've tried) is not available

I'm new to PI development, and I've researched this extensively. I'm looking for what I'm clearly I am clearly missing to sync up the two versions and get the debugger to attach to a program running on the PI (which is running fine)

I have the environmental variable for DOTNET_ROOT set correctly, with the latest PI installation, and debugger installed as well enter image description here

enter image description here

enter image description here


Solution

  • Don't use the dotnet-install script, that is for CI (continuous integration) only. To install dotnet on the Raspberry Pi, go to https://aka.ms/dotnet-download and download the binaries(!) for version 7.0.2 for Arm64 (assuming you already have the 64 bit version of Raspberry Pi OS installed).

    The instructions on the download page will install the runtime only for the current user. I would recommend to install it globally (there's typically only one user on a Raspberry Pi, anyway). To do so, run these commands:

    sudo mkdir /usr/share/dotnet
    sudo tar zxf dotnet-sdk-7.0.102-linux-arm64.tar.gz -C /usr/share/dotnet
    sudo ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet
    

    (setting DOTNET_ROOT is not necessary)

    to verify proper installation, run

    dotnet --info
    

    When a new version becomes available (or you also need to install version 6.0 in parallel), just extract the package to the same directory. They can install side-by-side.