- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 736
 
ASP.Net
ASP.NET Core remains the recommended approach for complex web applications with ElectronNET.Core, providing all the benefits of the ASP.NET ecosystem along with enhanced Electron integration.
See System Requirements.
Create a new ASP.NET Core Web App in Visual Studio by selecting New Project and choosing one of the ASP.NET Core project templates.
dotnet new webapp -n MyElectronWebApp
cd MyElectronWebAppRight-click the solution and select Manage Nuget Packages.
Finr and install ElectronNET.Core as well as ElectronNET.Core.AspNet.
dotnet add package ElectronNET.Core
dotnet add package ElectronNET.Core.AspNetNote
The API package is automatically included as a dependency of ElectronNET.Core.
Update your Program.cs to enable Electron.NET:
using ElectronNET.API;
using ElectronNET.API.Entities;
public class Program
{
    public static void Main(string[] args)
    {
        var builder = WebApplication.CreateBuilder(args);
        builder.Services.AddRazorPages();
        // Add this line to enable Electron.NET:
        builder.UseElectron(args, ElectronAppReady);
        var app = builder.Build();
        if (!app.Environment.IsDevelopment())
        {
            app.UseExceptionHandler("/Error");
        }
        app.UseStaticFiles();
        app.UseRouting();
        app.UseAuthorization();
        app.MapRazorPages();
        app.Run();
    }
    public static async Task ElectronAppReady()
    {
        var browserWindow = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions { Show = false });
        browserWindow.OnReadyToShow += () => browserWindow.Show();
    }
}If you want to launch a specific URL, you can retrieve the actual ASP.NET port from the new ElectronNetRuntime static class, for example:
    await browserWindow.WebContents
        .LoadURLAsync($"http://localhost:{ElectronNetRuntime.AspNetWebPort}/mypage.html");For projects using the traditional Startup.cs pattern, please see "Traditional ASP.NET Core" in the Migration Guide.
ElectronNET.API can be added to your DI container within the Startup class. All of the modules available in Electron will be added as Singletons.
using ElectronNET.API;
public void ConfigureServices(IServiceCollection services)
{
    services.AddElectron();
}- Debugging - Learn about ASP.NET debugging features
 - Package Building - Create distributable packages
 - Startup Methods - Understanding launch scenarios
 
✅ Full Web Stack - Use MVC, Razor Pages, Blazor, and all ASP.NET features
✅ Hot Reload - Edit ASP.NET code and see changes instantly
✅ Rich Ecosystem - Access to thousands of ASP.NET packages
✅ Modern Development - Latest C# features and ASP.NET patterns
✅ Scalable Architecture - Build complex, maintainable applications
Want to contribute to this documentation? Please fork and create a PR! The Wiki is autogenerated from the /docs content in the repository.