ElectronNET.Core represents a fundamental modernization of Electron.NET, addressing years of accumulated pain points while preserving full API compatibility. This isn't just an updateβit's a complete rethinking of how .NET developers build and debug cross-platform desktop applications with Electron.
Read more: What's New in ElectronNET.Core
Build cross platform desktop applications with .NET 6/8 - from console apps to ASP.Net Core (Razor Pages, MVC) to Blazor
Well... there are lots of different approaches how to get a X-plat desktop app running. Electron.NET provides a range of ways to build .NET based solutions using Electron at the side of presentation. While the classic Electron.Net setup, using an ASP.Net host ran by the Electron side is still the primary way, there's more flexibility now: both, dotnet and Electron are now able to launch the other for better lifetime management, and when you don't need a local web server - like when running content from files or remote servers, you can drop the ASP.Net stack altogether and got with a lightweight console app instead.
ElectronNET.Core |
ElectronNET.Core.API |
ElectronNET.Core.AspNet
Our API uses .NET 6/8, so our
Also you should have installed:
- .NET 6/8 or later
- OS minimum base OS is the same as .NET 6 / .NET 8.
- NodeJS (at least Version 22.x)
- Create a new ASP.Net Core project
- Install the following two nuget packages:
dotnet add package ElectronNET.Core
dotnet add package ElectronNET.Core.AspNetTo do so, use the UseElectron extension method on a WebApplicationBuilder, an IWebHostBuilder or any descendants.
Note
New in Electron.NET Core is that you provide a callback method as an argument to UseElectron(), which ensures that you get to know the right moment to set up your application UI.
using ElectronNET.API;
using ElectronNET.API.Entities;
public static void Main(string[] args)
{
WebHost.CreateDefaultBuilder(args)
.UseElectron(args, ElectronAppReady)
.UseStartup<Startup>()
.Build()
.Run();
}
public static async Task ElectronAppReady()
{
var browserWindow = await Electron.WindowManager.CreateWindowAsync(
new BrowserWindowOptions { Show = false });
browserWindow.OnReadyToShow += () => browserWindow.Show();
}Just press F5 in Visual Studio or use dotnet for debugging.
A complete documentation is available on the Wiki.
In this YouTube video, we show you how you can create a new project, use the Electron.NET API, debug a application and build an executable desktop app for Windows: Electron.NET - Getting Started
Note
The video hasn't been updated for the changes in ElectronNET.Core, so it is partially outdated.
- Gregor Biswanger - (Microsoft MVP, Intel Black Belt and Intel Software Innovator) is a freelance lecturer, consultant, trainer, author and speaker. He is a consultant for large and medium-sized companies, organizations and agencies for software architecture, web- and cross-platform development. You can find Gregor often on the road attending or speaking at international conferences. - Cross-Platform-Blog - Twitter @BFreakout
- Dr. Florian Rappl - Software Developer - from Munich, Germany. Microsoft MVP & Web Geek. - The Art of Micro Frontends - Homepage - Twitter @florianrappl
- softworkz - full range developer - likes to start where others gave up - MS MVP alumni and Munich citizen as well
- Robert Muehsig - Software Developer - from Dresden, Germany, now living & working in Switzerland. Microsoft MVP & Web Geek. - codeinside Blog - Twitter @robert0muehsig
See also the list of contributors who participated in this project.
Feel free to submit a pull request if you find any bugs (to see a list of active issues, visit the Issues section. Please make sure all commits are properly documented.
We do this open source work in our free time. If you'd like us to invest more time on it, please donate. Donation can be used to increase some issue priority. Thank you!
Alternatively, consider using a GitHub sponsorship for the core maintainers:
Any support appreciated! π»
MIT-licensed. See LICENSE for details.
Enjoy!
