Electron.NET Uses ASP.NET Core 2.0 for Cross-Platform Desktop Apps
Two Microsoft MVPs have collaborated on a project called Electron.NET that uses the open source ASP.NET Core 2.0 framework to create cross-platform desktop apps running on Windows, OSX and Linux.
It's based on a derivation of .NET Core 2.0 -- the modular, open source implementation of the managed Microsoft .NET Framework -- and its cousin, ASP.NET Core 2.0, a similar implementation of Microsoft's framework for building Web apps with programming languages such as C#, F# and Visual Basic.
While the project allows for the novel application of C# and ASP.NET Core 2.0 to build cross-platform desktop apps, co-developer Gregor Biswanger said, "We haven't reinvented the wheel. The runtime is based on Electron. So Electron.NET is built on an advanced and solid platform."
Full documentation isn't yet ready for the young project, but the Germany-based Biswanger -- who created Electron.NET with Robert Muehsig, a fellow Microsoft MVP living in Switzerland -- published a blog post detailing how to create a music player app using Visual Studio 2017's "ASP.NET Core Web Application" template, Node.js (v8.x) and the .NET Core 2.0 SDK.
The ElectronNET.API is added to the project via the NuGet package manager. Electron.NET projects also use the ElectronNET.CLI NuGet package.
Source code for Electron.NET is available on GitHub, where the MIT-licensed project has amassed 587 stars (and is climbing by the minute today).
As usual, developers must have access to a Mac or Linux machine to build Mac applications. The nascent project still has some rough edges, as the GitHub site says, "OSX builds on Windows are currently not supported, because the build just hangs, but I'm not sure why. It works on Linux/OSX however."
Nevertheless, the project provides some novel capabilities. "We've seen in this sample, how easy it is to create a desktop software using ASP.NET MVC Core 2," Biswanger said in his post on creating the music player. "We get access to the files by using C# and send those information to the MVC view, which is actually not possible through a Web-Browser."
Electron.NET actually isn't the first project to combine .NET Core and Electron for cross-platform desktop apps, as developer Rui Figueiredo published a similar GitHub project, described as a "Simple cross-platform desktop to demonstrate how .NET Core can be used in an Electron application." You can read more about that project in this post.
Figueiredo actually commented on Biswanger's introductory article: "A while back I wrote this post about building a cross-platform desktop application with Electron and .NET Core. I like your approach and I'm going to see if it can be used to improve my solution."
Lengthy comment threads on a Hacker News post about Electron.NET touch on the issue of cross-platform desktop development in general, discussing several alternative approaches such as Qt, Progressive Web Apps, Java Swing, Avalonia, WinForms, Xamarin and others.
None of those seemed to fit the bill for one developer, though, who lamented: "Can't we just make a proper, easy to use portable desktop application framework please?"
David Ramel is an editor and writer for Converge360.