A sample application demonstrating how to build desktop applications using Electron.NET, a framework that combines ASP.NET Core with Electron to create cross-platform desktop applications.
This project showcases an Electron.NET application built with:
- ASP.NET Core (.NET 8.0) - Backend and web framework
- Electron.NET - Desktop application integration
- Razor Pages - Frontend UI
- Custom Electron Main Process - Advanced Electron configuration
ElectronNetSampleApp/
├── Pages/ # Razor Pages for UI
├── Properties/ # Build and launch configuration
├── wwwroot/ # Static files (CSS, JS, libraries)
├── electron/ # Electron-specific files
│ └── custom_main.js # Custom Electron main process
├── appsettings.json # Application settings
├── Program.cs # Application startup configuration
└── ElectronNetSampleApp.csproj
- .NET 8.0 SDK or later
- Node.js (required for Electron)
- npm or yarn (for managing Electron dependencies)
- Windows (configured for
win-x64runtime)
git clone https://github.com/yourusername/explore_electron_net.git
cd explore_electron_netdotnet restoredotnet builddotnet runThe desktop application window should launch automatically.
To build a distributable Electron package:
dotnet publish -c ReleaseThe Electron builder configuration is located in Properties/electron-builder.json.
This project uses a custom Electron main process (electron/custom_main.js) for advanced configuration. See the CUSTOM_MAIN_GUIDE.md file for implementation details.
Key settings are defined in:
appsettings.json- General application settingsappsettings.Development.json- Development-specific settingsProperties/launchSettings.json- Launch profiles
ElectronNET.Core- Core Electron.NET runtimeElectronNET.Core.API- Electron API bindingsElectronNET.Core.AspNet- ASP.NET Core integration
Managed through Electron's integrated npm environment.
- Razor Pages for server-rendered UI
- Bootstrap for responsive design
- jQuery for client-side interactions
- jQuery Validation for form validation
- ASP.NET Core middleware pipeline
- Razor Pages with code-behind support
- Built-in dependency injection via Electron.NET
- Custom Electron main process for advanced window management
- Auto-hiding menu bar for cleaner UI
- Window ready detection for optimal load handling
- Cross-platform desktop application (configured for Windows)
- Server-rendered UI with Razor Pages
- Built-in web server powered by ASP.NET Core
- Seamless integration between .NET and Electron
- Customizable Electron main process
Ensure Node.js is installed and available in your PATH.
Clear the build artifacts:
dotnet clean
dotnet restore
dotnet buildCheck that the ASP.NET Core server is running and accessible. Verify appsettings.json for correct port configuration.
Contributions are welcome! Please feel free to submit pull requests or open issues for bugs and feature requests.
This project is licensed under the MIT License - see the LICENSE file for details.
For questions or support, please open an issue in the GitHub repository.