.NET FastIoT VS Code Extension
.NET FastIoT Extension in Visual Studio Code Marketplace.
README in English | README на русском языке | DevDotNet.ORG (Russian) - latest news | Habr.com (Russian) - Easy development of IoT applications in C # for Raspberry Pi and other SBCs, on Linux.
This extension allows you configures an ARMv7 or ARMv8 Linux embedded device to run .NET applications, and configures
*.csproj projects for remote debugging via an ssh-tunnel. This has been tested on Windows (64 bits).
Devices supported: Raspberry Pi, Banana Pi, Orange Pi, Radxa, Tinkerboard, Odroid, Khadas VIM, NanoPi, Pine.
.NET FastIoT Extension UI
- Easy installation .NET SDK, .NET Runtimes, .NET Debugger (vsdbg), Libgpiod, Docker for Linux;
- Setting up .NET projects for remote debugging, adding environment variables (Method Environment.GetEnvironmentVariable);
- Device Tree overlays management. Required to turn on/off devices such as I2C, SPI, PWM, etc. Available remote download of files
* .DTS and enable/disable "layers". See Working with GPIO. Part 2. Device Tree overlays (RU). Only the Armbian distribution is supported. To support other distributions, the adapter must be implemented using the IDtoAdapter.ts interface. Armbian implementation example - IoTDTOArmbianAdapter.ts;
- GPIO pin control (not fully implemented yet). Detecting available Gpiochip ~~and lines. Applying
0/1 to the contact, reading the state of the contact. Generation of C# code for the selected contact for transferring to the project one-to-one.~~
- OS version . Windows 7-10 (x64). Linux version coming later;
- Visual Studio Code. version not lower than 1.70.3;
- .NET. Compiling a C# project requires .NET SDK depending on which version of your project you are using (the extension itself is not required to work);
Additional extensions required for developing .NET applications:
- cwRsync. The package uses the rsync and ssh utilities. Included in the extension and copied to the default folder
C:\RemoteCode\cwrsync\ (location changes in settings). Optionally, you can replace the package by downloading it from the official website at the link. The PuTTY terminal is not used.
Third-party bash scripts to install packages/libraries:
System requirements for the device
- Processor. ARMv7 or ARMv8;
- OS version. Linux distribution based on at least Ubuntu 18.04 (Bionic Beaver), or at least Debian 10.11 (Buster);
Step 1 — Preparing the device
The single board computer must be running a Debian distribution or Ubuntu, Linux. For remote access, you need to install an ssh server and configure certain settings. As a terminal for remote access, you can use MobaXterm (much more convenient compared to the PuTTY terminal). If the
sudo is not installed, then install this package as
root using the commands:
apt-get install -y sudo
To install an ssh-server and configure access, run the following commands on a single board computer:
sudo apt-get update
sudo apt-get install -y openssh-server mc
sudo systemctl reload ssh
sudo mcedit /etc/ssh/sshd_config
In the editor that opens, set the following parameters. If these parameters are missing, then just insert the line (usually the
AuthenticationMethods is missing):
AuthenticationMethods publickey keyboard-interactive password
Then save the changes F2 and exit the editor F10.
Restart the ssh-server to apply the new settings:
sudo systemctl reload ssh
sudo systemctl status ssh
The last command displays the current status of the service.
Video instruction for setting up an ssh server for connecting an extension:
Step 2 — Adding a device
At the first connection, a pair of access keys is created, private and public. The private key is copied to the
C:\RemoteCode\keys\ folder (the location is changed in the settings). This key is used to configure the device and start remote debugging.
The important point is choosing an account to create on the device. The first option is the debugvscode account (the name can be changed in the settings), the second option is root:
Selecting an account to create on the device
Selecting the debugvscode option creates a permissions configuration file 20-gpio-fastiot.rules to devices using the udev subsystem. A group named iotis created, and permissions for devices such as: gpiochip, I2C, SPI, PWM, etc. Then the user debugvscode is added to this group. Due to the fact that testing was performed only on Armbian, it is possible that not all permissions have been added. Therefore, if you have problems with access rights to devices, then choose — root.
Adding a new device (YouTube):
Step 3 — Installing packages
To run a .NET IoT application and perform remote debugging, you need to install:
- Runtime - .NET Runtime.
- Remote debugger - .NET Debugger (vsdbg).
- GPIO line control library - Libgpiod (optional).
Installing the Libgpiod library is possible from the repository and source code. If the repository contains an old version of the library, then install the library from source.
Step 4 — Launch configuration
Now you need to open the project or create it. Project example dotnet-iot-fastiot-test.
To create a remote debugging configuration on the device, you must click on the Add Configuration button:
Select a device for remote debugging:
The application launch configuration has been created.
Now you need to go to
Run and Debug:
Select configuration to run:
Run the project on debugging menu
Run > Start Debugging.
*.csproj test projects are located in the folder samples. The first base project for testing remote debugging is
dotnet-iot-fastiot-test. Other projects are located in the devdotnetorg/dotnet-iot-samples repository.
To change the extension settings, open the menu item
File > Preferences > Settings. Then go to the
User tab and select
- Conf › Resource: Insert Empty Last Line - device data is stored in the
fastiot.device.all.JSON node in JSON format, it is not recommended to change it manually. Due to incorrect changes, the device list may not load.
- Fastiot › Device › Account: Groups - Linux user group on a remote device (eg Raspberry Pi) to which the account (
debugvscode) will be added to control the device. This group must have Administrator rights.
- Fastiot › Device › Account: Username - account name created on the remote device. Used to control the device and perform remote debugging. Default value:
- Fastiot › Device › All: JSON - device settings in JSON format, it is not recommended to change them manually. Due to incorrect changes, the device list may not load.
- Fastiot › Device: Pathfoldercwrsync - folder with cwRsync program. Default value:
- Fastiot › Device: Pathfolderkeys - folder for storing access keys to devices (eg Raspberry Pi).
- Fastiot › Launch: Templatetitle - template for forming the name of the debugging profile. The values of the variables can be viewed at the link. Default value:
Launch on %DEVICE_LABEL% (%NAME_PROJECT%, %BOARD_NAME%, %USER_DEBUG%).
- Step 1. Configuring SSH access
- Step 2. Adding a device
- Step 3. Installing packages
- Step 4. Creating a .NET console application and remote debugging
- Step 5. Using GPIO. Blink
See ISSUES.md and Issues.
Send your comments by email
firstname.lastname@example.org. And check in Issues.
This software is licensed under the terms of the LGPL-3.0 license.
See LICENSE for more details.
Testing performed on single board computers: