I would like to introduce a Electron.NET That library wraps electron and asp.net core application.
To test Electron.NET we need to install it. So, type:
dotnet tool install ElectronNET.CLI -g
After that we can create solution file
dotnet new sln -n ElectronHelloWorld
now we can add asp.net web application
dotnet new razor -lang C# -n ElectronApplication -o ElectronApplication
we need to add Electron.NET to our project, so type this
dotnet add package ElectronNET.API
add UseElectron
in Program.cs
public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseElectron(args); webBuilder.UseStartup<Startup>(); });
and add this line
Task.Run(async () => await Electron.WindowManager.CreateWindowAsync());
to the end of Configure
method in Startup.cs
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Error"); app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapRazorPages(); }); Task.Run(async () => await Electron.WindowManager.CreateWindowAsync()); }
type this in ElectronApplication
folder
electronize init electronize start
and voilà 🙂

I’ve found this library today and I haven’t made any big project with Electron.NET. But the first impression is very nice. I’m going make a bigger project with this tool.