I wrote about using the open-source tool  Electron.NET to implement cross-platform desktop applications for Windows, macOS, and Linux platforms in a previous  blog post. By providing a wrapper around a standard Electron application with an embedded ASP.NET Core website, Electron.NET allows C## developers to target multiple platforms without coding in JavaScript.

This blog post illustrates how you can apply the same techniques to create Blazor desktop applications. Topics covered include:

  • Modifying the default Blazor Server application to use Electron.NET
  • Using Visual Studio Code to debug Blazor pages
  • Implementing native UI elements such as message boxes
  • Adding third-party Blazor controls
  • Building deployment media for other platforms

Background

Electron is a framework that supports the development of desktop applications using web technologies such as the Chromium rendering engine and the Node.js runtime. Supported operating systems include Windows, macOS, and Linux. It leverages familiar standards such as HTML, CSS, and JavaScript.

Electron.NET allows .NET developers to invoke native Electron APIs using C#. It consists of two components:

  • A NuGet package that adds Electron APIs to an ASP.NET Core or Blazor project.
  • A .NET Core command-line extension that builds and launches applications for Windows, macOS, and Linux platforms.

Electron.NET requires the prior installation of the following software:

  • Node.js
  • .NET 5.0

Let’s get started by building the canonical Blazor application from the command line.

#web #.net #desktop

Building Blazor Desktop Apps with Electron.NET
5.90 GEEK