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 for Converge360.

comments powered by Disqus

Featured

  • Creating Reactive Applications in .NET

    In modern applications, data is being retrieved in asynchronous, real-time streams, as traditional pull requests where the clients asks for data from the server are becoming a thing of the past.

  • AI for GitHub Collaboration? Maybe Not So Much

    No doubt GitHub Copilot has been a boon for developers, but AI might not be the best tool for collaboration, according to developers weighing in on a recent social media post from the GitHub team.

  • Visual Studio 2022 Getting VS Code 'Command Palette' Equivalent

    As any Visual Studio Code user knows, the editor's command palette is a powerful tool for getting things done quickly, without having to navigate through menus and dialogs. Now, we learn how an equivalent is coming for Microsoft's flagship Visual Studio IDE, invoked by the same familiar Ctrl+Shift+P keyboard shortcut.

  • .NET 9 Preview 3: 'I've Been Waiting 9 Years for This API!'

    Microsoft's third preview of .NET 9 sees a lot of minor tweaks and fixes with no earth-shaking new functionality, but little things can be important to individual developers.

  • Data Anomaly Detection Using a Neural Autoencoder with C#

    Dr. James McCaffrey of Microsoft Research tackles the process of examining a set of source data to find data items that are different in some way from the majority of the source items.

Subscribe on YouTube