-
-
Notifications
You must be signed in to change notification settings - Fork 741
Templates
Electron.NET ships a dotnet new template package so you can scaffold a ready-to-run desktop app instead of wiring up an ASP.NET project by hand.
See System Requirements.
dotnet new install ElectronNET.Core.TemplatesTo update to the latest version, run the same command again. To remove them:
dotnet new uninstall ElectronNET.Core.Templates| Template | Short name | Description |
|---|---|---|
| Electron.NET Blazor App | electron-blazor |
A Blazor Server app hosted in an Electron shell |
dotnet new electron-blazor -n MyDesktopApp
cd MyDesktopAppThen start it in the Electron shell:
dotnet build
dotnet run| Option | Values | Default | Description |
|---|---|---|---|
-f, --framework
|
net8.0, net10.0
|
net10.0 |
The target framework of the generated project |
-e, --electron-version
|
any Electron version | 38.2.2 |
The Electron version the app is built against |
-p, --port
|
port number | 8001 |
The port the ASP.NET server uses during development |
--no-restore |
— | — | Skip the automatic dotnet restore
|
Example:
dotnet new electron-blazor -n MyDesktopApp -f net10.0 -e 30.4.0 -p 8123MyDesktopApp/
├── Components/
│ ├── Layout/ MainLayout.razor, NavMenu.razor
│ ├── Pages/ Home.razor, Counter.razor
│ ├── App.razor
│ ├── Routes.razor
│ └── _Imports.razor
├── Properties/
│ ├── PublishProfiles/ win-x64, linux-x64 and osx-arm64 folder profiles
│ ├── electron-builder.json
│ └── launchSettings.json
├── wwwroot/app.css
├── appsettings.json
├── Program.cs
└── MyDesktopApp.csproj
The project already references ElectronNET.Core and ElectronNET.Core.AspNet, calls builder.UseElectron(...) in Program.cs, and passes all Migration Checks out of the box.
Note
ElectronNET.API also defines a type named App, which collides with the Blazor root
component. That is why the template calls app.MapRazorComponents<MyDesktopApp.Components.App>()
with a fully qualified type name.
- Configuration - Adjust app metadata and Electron settings
- Debugging - Debug the .NET and Electron sides
- Package Building - Create distributable packages
Want to contribute to this documentation? Please fork and create a PR! The Wiki is autogenerated from the /docs content in the repository.
-
Configuration
-
Startup-Methods
-
Debugging
-
Package Building
-
Secure Communication
-
Adding a
custom_main.js
-
API Overview
-
Electron.App
-
Electron.Dialog
-
Electron.Menu
-
Electron.WindowManager
-
Electron.Shell
-
Electron.Screen
-
Electron.Notification
-
Electron.Tray
-
Electron.Clipboard
-
Electron.Dock
-
Electron.HostHook
-
Electron.IpcMain
-
Electron.GlobalShortcut
-
Electron.AutoUpdater
-
Electron.NativeTheme
-
Electron.PowerMonitor
custom_main.js