Deploying & Debugging Visual Studio applications over Ethernet

  • How to debug your Windows IoT application over ethernet with Visual Studio 2019

    To debug a Visual Studio 2019 application on your F&S Single Board Computer / System on Module (now SBC/SoM) running Windows IoT, several actions must be performed. On SBC/SoM the remote tools (i.e. Remote Debugger) need to be installed and launched. Additionally, the project must be set up in visual studio so that a connection to the SBC/SoM can be established. Once configured, you can build your project and it will automatically deploy and execute the application on SBC/SoM.


    Configuration of SBC/SoM

    1) Passwordless connection (only needed when User on SBC/SoM has no password)

    Using a User on SBC/SoM without a password, it is essential to allow a passwordless connection.

    • Launch Regedit as an Administrator
    • Navigate to [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa]
    • If the "LimitBlankPasswordUse" entry is not already present, create it by right-clicking in the window, selecting New > DWORD (32-bit) Value, and name it "LimitBlankPasswordUse" with value "0"
    • If the "LimitBlankPasswordUse" entry is already present, double-click on it, and change the data to 0 (zero) to allow the use of blank passwords (or to 1 if you want to prevent blank passwords over the network

    • Restart the system

    NOTICE: Of course, it is not recommended not to use a password!


    2) Change sharing options

    First of all you have to activate the network discovery and file & printer sharing. You can find this settings under

    Control Panel > Network and Internet > Network and Sharing Center > Advanced sharing settings


    3) Create target directory

    For the Visual Studio application, create a target directory on the SBC/SoM. In order for this target directory to be accessible from the developer PC, it needs to be shared, either for all users or for the specific (local) user.

    For example: Create a directory named "debug" in the root directory (C:\) of the SBC/SoM. Afterward, access the properties of this directory. Proceed to the "Sharing" tab

    and click on the "Share" button. Select at least the local user of the SBC/SoM to share the directory with.


    Now it should be possible to access this “debug” directory via File explorer from the developer PC.


    4) Remote Debugger Installation

    After all important prerequisites have been met, we proceed with the actual installation and setup of the Remote Debugger Tool.

    For this purpose, you will need the following file: VS2019_RemoteTools.exe. This file can be downloaded directly from Microsoft Visual Studio or from our fileshare.


    Run the .exe file on the SBC/SoM and proceed with the installation. After the application has been successfully installed run this “Remote Debugger” application. The Remote Debugger is a small dialog that displays notifications. We will keep this dialog open and now focus on the developer machine that wants to access it.




    Configuration of developer PC / Visual Studio

    1) Visual Studio Application Property Page

    To establish a remote debugger connection from the developer PC, the following steps must be performed:

    In the project settings of the C++ project (not solution properties!), you have to navigate to the Debugger configuration. Under "Debugging", the "Remote Windows Debugger" has to be selected.


    Described below are the key parameters required for configuring remote debugging settings:

    Parameter
    Description
    Remote Command Refers to the pathway leading to the executable file of your application located on the remote server (SBC/SoM)
    Working Directory Designates the location where the remote command is executed. Utilizing the browse function, you can directly select the previously created "debug" directory. This step is highly recommended because it ensures the accurate pathway. Additionally, this path can be employed for other parameters, such as the remote command or the deployment directory
    Remote Server Name Connection details of the target machine (SBC/SoM). The information regarding the machine's name and port can be found in the Remote Debugger dialog (see Remote Debugger Installation). In our case it is: DESKTOP-ANTON5C:4024
    Debugger Type Determines which type of debugger will be employed to remote debugging. Based on our platform, we choose the "native only" option
    Deployment Directory Path on the remote server(SBC/SoM) where your application files or resources are copied before debugging commences. This step is essential to ensure that the remote application has all the required files to function properly and be debugged effectively.


    NOTICE:

    Instead of using the name "\\DESKTOP-ANTON5C" you can also use the IP address (e.g. \\10.0.0.200) of the SBC/SoM. However, this is not recommended as the IP address tends to change frequently (DHCP).


    2) Visual Studio Solution Configuration Manager

    After configuring the debugging settings, the final step is to set up the deployment of files. This can be achieved by accessing the Configuration Manager within the project solution (right-click on the solution > Configuration Manager).



    It is important here to ensure the correct active Solution configuration and platform are selected. Also, for the specific project (in this case: GPIOTestTool), make sure to check both BUILD and DEPLOY.


    With these steps completed, all settings for remote debugging should be set. Good work:thumbsup: