User Tools

Site Tools

한국어

comfilepi:dotnet_core_development

This is an old revision of the document!


.NET Development

.NET 5 and later brings a professional .NET runtime to Linux-based PCs like the ComfilePi.

Graphical User Interfaces and HMIs can now be created for Linux using the latest version of Visual Studio, .NET and C#. See the following GUI frameworks.

  • ComfileTech.Winforms - A port of the Mono Winforms implementation to .NET 10
  • Blazor - Create both remote and local UIs using web technologies. See a demonstration.
  • Avalonia — Mature, open-source, XAML/C# cross-platform .NET UI framework with strong Linux desktop support
  • Uno Platform — XAML/C# cross-platform .NET UI framework using WinUI-style APIs; supports Linux desktop and embedded Linux targets.
  • Gir.Core — C# bindings for GObject-based libraries such as GTK; good for native GTK 4 / GNOME-style Linux apps with .NET.

Install the .NET SDK on the ComfilePi

Trixie

.NET 10 SDK

The ComfilePi Trixie OS includes Microsoft's Debian repository and the .NET SDK is installed by default. Simply use apt to install or uninstall the dotnet* packages.

Bookworm

.NET 10 SDK

Starting with .NET 10, Microsoft is publishing ARM64 Linux packages. Follow Microsoft's Debian 12 instructions to install the .NET 10 SDK on a ComfilePi running the Bookworm OS.

.NET 9 SDK

Prior to .NET 10, Microsoft had not published ARM64 packages for the .NET SDK, so we filled that gap in our Bookworm OS by creating our own .NET SDK installation packages.

sudo apt update
sudo apt install cpi-dotnet-sdk-9.0
.NET 8 SDK

Prior to .NET 10, Microsoft had not published ARM64 packages for the .NET SDK, so we filled that gap in our Bookworm OS by creating our own .NET SDK installation packages.

sudo apt update
sudo apt install cpi-dotnet-sdk-8.0

Bullseye

ComfilePi OS images dated 2022-07-26 or later have the .NET SDK already installed. Verify by running the command dotnet –version in a terminal. If you need a later version than that which is installed, use the manually installation process below.

Any OS

Any version of the .NET SDK can be installed manually using the following commands.

DOTNET_VERSION=10.0  # Choose your version
wget https://builds.dotnet.microsoft.com/dotnet/scripts/v1/dotnet-install.sh
chmod +x dotnet-install.sh
sudo ./dotnet-install.sh --channel $DOTNET_VERSION --install-dir /opt/Microsoft/dotnet
sudo ln -s /opt/Microsoft/dotnet/dotnet /usr/local/bin/dotnet
 
# Create a configuration file telling the system where to find the .NET runtime
sudo mkdir /etc/dotnet
sudo bash -c 'echo /opt/Microsoft/dotnet/ >> /etc/dotnet/install_location'

Test the installation by running dotnet --version in a terminal.

Workaround for .NET ARM Linux Garbage Collection Bug (.NET 8 & 9 Only)

Important - Due to a bug in the .NET runtime, it may be necessary to restrict the .NET garbage collector's memory limit on devices with small amounts of memory (e.g. a Raspberry Pi) or .NET applications may abort prematurely. To set the garbage collector's memory limit, create or open the file /etc/environment, and add the following line to the file.

DOTNET_GCHeapHardLimitPercent=32

Then reboot.

For more information about this setting, see Microsoft's official documentation.

Install the .NET SDK on a Development PC

It is likely much more convenient to author code on a development PC. To do that there are a few options:

* Download Visual Studio 2022 or later and install it on a development PC. When installing, be sure to select the options for .NET development. It will install both the Visual Studio IDE and the .NET SDK.

* Download the .NET SDK and install install it on development PC. You can then use the dotnet command in a terminal window to create, compile, and publish projects

* Download Visual Studio Code as a companion IDE for the dotnet command line tools available after downloading and installing the .NET SDK.

Publishing, Deploying, and Running a .NET Application

To get a .NET application from your development environment to a ComfilePi, you need to perform the following steps in order:

  1. Publish the application for the ComfilePi's CPU architecture and operating system.
  2. Deploy the resulting binaries to a ComfilePi panel PC.
  3. Execute the binaries on the ComfilePi panel PC.

Those steps can all be done using using Visual Studio, the dotnet CLI, and/or Visual Studio Code.

See also Deploy .NET apps on ARM single-board computers

Debugging a Project

To deploy to, launch and debug .NET applications on the ComfilePi from within Visual Studio or Visual Studio Code using the following extensions.

See also Debug .NET apps on the Raspberry Pi.

comfilepi/dotnet_core_development.1780892989.txt.gz · Last modified: by mfranklin