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

  • Hands On: New VS Code Insiders Build Creates Web Page from Image in Seconds

    New Vision support with GitHub Copilot in the latest Visual Studio Code Insiders build takes a user-supplied mockup image and creates a web page from it in seconds, handling all the HTML and CSS.

  • Naive Bayes Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the naive Bayes regression technique, where the goal is to predict a single numeric value. Compared to other machine learning regression techniques, naive Bayes regression is usually less accurate, but is simple, easy to implement and customize, works on both large and small datasets, is highly interpretable, and doesn't require tuning any hyperparameters.

  • VS Code Copilot Previews New GPT-4o AI Code Completion Model

    The 4o upgrade includes additional training on more than 275,000 high-quality public repositories in over 30 popular programming languages, said Microsoft-owned GitHub, which created the original "AI pair programmer" years ago.

  • Microsoft's Rust Embrace Continues with Azure SDK Beta

    "Rust's strong type system and ownership model help prevent common programming errors such as null pointer dereferencing and buffer overflows, leading to more secure and stable code."

  • Xcode IDE from Microsoft Archrival Apple Gets Copilot AI

    Just after expanding the reach of its Copilot AI coding assistant to the open-source Eclipse IDE, Microsoft showcased how it's going even further, providing details about a preview version for the Xcode IDE from archrival Apple.

Subscribe on YouTube

Upcoming Training Events