ElectronNET.Core.API 0.2.0-pre.239

This is a prerelease version of ElectronNET.Core.API.
There is a newer version of this package available.
See the version list below for details.
dotnet add package ElectronNET.Core.API --version 0.2.0-pre.239
                    
NuGet\Install-Package ElectronNET.Core.API -Version 0.2.0-pre.239
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ElectronNET.Core.API" Version="0.2.0-pre.239" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ElectronNET.Core.API" Version="0.2.0-pre.239" />
                    
Directory.Packages.props
<PackageReference Include="ElectronNET.Core.API" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ElectronNET.Core.API --version 0.2.0-pre.239
                    
#r "nuget: ElectronNET.Core.API, 0.2.0-pre.239"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ElectronNET.Core.API@0.2.0-pre.239
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ElectronNET.Core.API&version=0.2.0-pre.239&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=ElectronNET.Core.API&version=0.2.0-pre.239&prerelease
                    
Install as a Cake Tool

Electron.NET Logo

donate Gitter Build status

Electron.NET Core is here!

A Complete Transformation

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/10 - from console apps to ASP.NET Core (Razor Pages, MVC) to Blazor.

Wait - how does that work exactly?

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.

📦 NuGet

  • ElectronNET.Core: NuGet
  • ElectronNET.Core.API: NuGet
  • ElectronNET.Core.AspNet: NuGet

🛠 Requirements to Run

You should have installed:

👩‍🏫 Usage with ASP.NET

  • Create a new ASP.NET Core project
  • Install the following two NuGet packages:
dotnet add package ElectronNET.Core

dotnet add package ElectronNET.Core.AspNet

Classic ASP.NET Core

Enable Electron.NET on Startup

To do so, use the UseElectron extension method on a WebApplicationBuilder, an IWebHostBuilder or any descendants.

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.

Program.cs
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();
}

Minimal API Example

For a minimal API you can use:

using ElectronNET;
using ElectronNET.API;
using ElectronNET.API.Entities;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddRazorPages();
builder.Services.AddElectron(); // <- might be useful to set up DI

builder.UseElectron(args, async () =>
{
    var browserWindow = await Electron.WindowManager.CreateWindowAsync(
        new BrowserWindowOptions { Show = false, AutoHideMenuBar = true });

    browserWindow.OnReadyToShow += () => browserWindow.Show();
});

var app = builder.Build();

// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
    app.UseExceptionHandler("/Error");
}

app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.MapRazorPages();
app.Run();

Blazor

For a project with Blazor you can use:

using ElectronNET.API;
using ElectronNET.API.Entities;

var builder = WebApplication.CreateBuilder(args);

builder.Services
    .AddRazorComponents()
    .AddInteractiveWebAssemblyComponents();

builder.Services.AddElectron(); // <-- might be useful to set up DI

builder.UseElectron(args, async () =>
{
    var options = new BrowserWindowOptions {
        Show = false,
        AutoHideMenuBar = true,
        IsRunningBlazor = true, // <-- crucial
    };
    var browserWindow = await Electron.WindowManager.CreateWindowAsync(options);
    browserWindow.OnReadyToShow += () => browserWindow.Show();
});

var app = builder.Build();

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
    app.UseWebAssemblyDebugging();
}
else
{
    app.UseExceptionHandler("/Error", createScopeForErrors: true);
}

app.UseStaticFiles();
app.UseAntiforgery();

app.MapRazorComponents<BlazorApp.Components.App>()
    .AddInteractiveWebAssemblyRenderMode();

app.Run();

The IsRunningBlazor option makes sure to set up the renderer in a way that Blazor can just run without any interference. This includes things such as HMR for development.

🚀 Starting and Debugging the Application

Just press F5 in Visual Studio or use dotnet for debugging.

📔 Usage of the Electron API

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

The video hasn't been updated for the changes in ElectronNET.Core, so it is partially outdated.

👨‍💻 Authors

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

🙋‍♀️🙋‍♂ Contributing

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.

🙏 Donate

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!

donate

Alternatively, consider using a GitHub sponsorship for the core maintainers:

Any support appreciated! 🍻

🎉 License

MIT-licensed. See LICENSE for details.

Enjoy!

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on ElectronNET.Core.API:

Package Downloads
ElectronNET.Core

Building cross platform electron based desktop apps with .NET Core and - optionally - ASP.NET Core. This package contains the ElectronNET project system.

ElectronNET.Core.AspNet

Building cross platform electron based desktop apps with .NET Core and - optionally - ASP.NET Core. This package contains the ASP.Net Core integration.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.3.0-pre.353 45 12/12/2025
0.3.0-pre.351 33 12/11/2025
0.3.0-pre.345 257 12/11/2025
0.3.0-pre.344 256 12/11/2025
0.3.0-pre.340 261 12/10/2025
0.3.0-pre.336 275 12/9/2025
0.3.0-pre.331 248 12/7/2025
0.3.0-pre.314 72 12/6/2025
0.3.0-pre.310 128 12/5/2025
0.3.0-pre.300 97 11/29/2025
0.3.0-pre.298 135 11/24/2025
0.3.0-pre.296 141 11/22/2025
0.3.0-pre.295 148 11/22/2025
0.3.0-pre.281 351 11/20/2025
0.3.0-pre.263 349 11/19/2025
0.3.0-pre.1 43 12/12/2025
0.2.0 651 11/16/2025
0.2.0-pre.262 371 11/19/2025
0.2.0-pre.255 281 11/17/2025
0.2.0-pre.254 287 11/17/2025
0.2.0-pre.249 253 11/17/2025
0.2.0-pre.240 184 11/16/2025
0.2.0-pre.239 176 11/16/2025
0.2.0-pre.235 85 11/16/2025
0.2.0-pre.228 115 11/15/2025
0.2.0-pre.219 109 11/15/2025
0.2.0-pre.200 179 11/14/2025
0.1.0 325 11/14/2025
0.1.0-pre.198 199 11/14/2025
0.1.0-pre.197 196 11/14/2025
0.1.0-pre.196 230 11/13/2025
0.1.0-pre.186 253 11/12/2025
0.1.0-pre.184 252 11/10/2025
0.1.0-pre.183 223 11/10/2025
0.1.0-pre.180 189 11/10/2025
0.1.0-pre.173 156 11/9/2025
0.1.0-pre.171 151 11/9/2025
0.1.0-pre.163 97 11/8/2025
0.1.0-pre.160 94 11/8/2025
0.1.0-pre.158 83 11/7/2025
0.1.0-pre.157 135 11/7/2025
0.1.0-pre.156 119 11/7/2025
0.1.0-pre.155 121 11/7/2025
0.1.0-pre.149 145 11/6/2025
0.1.0-pre.142 149 11/5/2025
0.1.0-pre.139 141 11/4/2025
0.1.0-pre.138 142 11/4/2025
0.1.0-pre.136 171 11/2/2025
0.1.0-pre.135 86 11/2/2025
0.1.0-pre.134 81 11/2/2025
0.1.0-pre.133 82 11/1/2025
0.0.18 305 10/31/2025
0.0.18-pre.123 95 10/31/2025