Let’s Learn Blazor: Creating a Desktop App with Electron.NET

Turn Blazor Server into a cross-platform desktop app using the open source Electron framework for .NET

Christopher Laine
IT Dead Inside
Published in
6 min readMar 5, 2022

--

This is one of several articles on Blazor I’ll be writing, all so engineers can get familiar with the capabilities and tricks of this burgeoning and exciting web technology

So you’ve started building a web app using Blazor, but you realise it’ll likely be better suited as a desktop app. That’s fair. Some apps just don’t lend themselves to web stuff. You want a tray icon; you want your app to run offline. There are any number of reasons you might want your app to run on a local workstation than in the cloud.

So what’s a developer to do? Well, Microsoft has all kinds of big plans with .NET Maui a cross-platform app development framework which will apparently link all the varied OS (including mobile) together under a grand unified field theory of app development.

However, at this point, .NET Maui is in early preview, so maybe you’re not ready to leap on that unproven bandwagon. After all, Microsoft projects are notorious for slipping deadlines and for .0 versions to be buggy as a college dorm mattress. Maybe you need something a big more stable, with a lot of bells and whistles ready to go.

So like so many devs, you turn your attention to the cross-platform app dev framework Electron.

After all, Electron lets you build OS native desktop apps using nodeJS / Javascript and has been doing so for a while now. Lots of desktop apps out in the wild are built on Electron, including the ubiquitous code editor of choice for so many VS Code.

Why Electron Isn’t For Everyone

I can’t speak for all devs, but I’m not the hugest fast of Javascript or better put nodeJS. I find the scaffolding buggy and sloppy, the package management bloated, and the complete anarchy of packages in the wild more than a bit unnerving.

--

--