News

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.

As its name suggests, the project weds those Microsoft-originated technologies with Electron, a framework for building cross-platform desktop apps with JavaScript, HTML and CSS, most often used in Web development.

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."

Coding the View
[Click on image for larger view.] Coding the View (source: Cross-Platform-Blog.com).

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?"

About the Author

David Ramel is an editor and writer at Converge 360.

comments powered by Disqus

Featured

  • Compare New GitHub Copilot Free Plan for Visual Studio/VS Code to Paid Plans

    The free plan restricts the number of completions, chat requests and access to AI models, being suitable for occasional users and small projects.

  • Diving Deep into .NET MAUI

    Ever since someone figured out that fiddling bits results in source code, developers have sought one codebase for all types of apps on all platforms, with Microsoft's latest attempt to further that effort being .NET MAUI.

  • Copilot AI Boosts Abound in New VS Code v1.96

    Microsoft improved on its new "Copilot Edit" functionality in the latest release of Visual Studio Code, v1.96, its open-source based code editor that has become the most popular in the world according to many surveys.

  • AdaBoost Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the AdaBoost.R2 algorithm for regression problems (where the goal is to predict a single numeric value). The implementation follows the original source research paper closely, so you can use it as a guide for customization for specific scenarios.

  • Versioning and Documenting ASP.NET Core Services

    Building an API with ASP.NET Core is only half the job. If your API is going to live more than one release cycle, you're going to need to version it. If you have other people building clients for it, you're going to need to document it.

Subscribe on YouTube