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

  • Mastering AI Development and Building AI Apps with GitHub Copilot

    Two Microsoft experts explain how GitHub Copilot is evolving from a coding assistant into a broader platform for building, customizing and testing AI-powered developer workflows.

  • VS Code 1.123 Adds Agent Session Sync, 1M Context Windows

    Microsoft released Visual Studio Code 1.123 on June 3, adding agent-focused features, larger model context support, integrated browser updates and a new delay for some automatic extension updates.

  • Copilot Billing Shock Hits Developers

    Developer complaints about GitHub Copilot's new usage-based billing model have centered on unexpectedly rapid AI credit consumption, and neither GitHub nor Microsoft has responded directly to the backlash, though they have previously published guidance to lessen model usage costs.

  • Hands On with GitHub Copilot App Technical Preview: Turning a Blazor Issue into a PR

    GitHub's brand-new Copilot desktop app, in technical preview, handled a small Blazor issue from planning through pull request creation, but the hands-on test also showed why developers still need to verify agent work in the running app before merging.

Subscribe on YouTube