Files
Electron.NET/README.md

133 lines
6.6 KiB
Markdown
Raw Normal View History

2023-03-30 09:38:19 +02:00
[![Electron.NET Logo](https://github.com/ElectronNET/Electron.NET/raw/main/assets/images/electron.net-logo.png)](https://github.com/ElectronNET/Electron.NET)
2017-10-17 15:32:09 +02:00
2023-04-03 09:53:56 +02:00
[![donate](https://img.shields.io/badge/Donate-Donorbox-green.svg)](https://donorbox.org/electron-net) [![Gitter](https://badges.gitter.im/ElectronNET/community.svg)](https://gitter.im/ElectronNET/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![Build status](https://github.com/ElectronNET/Electron.NET/actions/workflows/ci.yml/badge.svg)](https://github.com/ElectronNET/Electron.NET/actions/workflows/ci.yml)
2017-10-16 23:16:50 +02:00
2025-10-14 06:22:42 +02:00
# Electron.Net Core is here!
2025-10-14 06:22:42 +02:00
## A Complete Transformation
2025-10-14 06:22:42 +02:00
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.
2017-10-03 23:37:46 +02:00
2025-10-15 22:12:29 +02:00
Read more: [**What's New in ElectronNET.Core**](wiki/What's-New)
2025-10-14 06:22:42 +02:00
Build cross platform desktop applications with .NET 6/8 - from console apps to ASP.Net Core (Razor Pages, MVC) to Blazor
2017-10-29 23:42:50 +01:00
2025-10-14 06:22:42 +02:00
## Wait - how does that work exactly?
2025-10-14 06:22:42 +02:00
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.
2019-10-15 00:21:36 +02:00
2025-10-14 06:22:42 +02:00
## 📦 NuGet
2019-10-15 00:21:36 +02:00
2025-10-14 06:22:42 +02:00
[![NuGet](https://img.shields.io/nuget/v/ElectronNET.Core.svg?style=flat-square) ElectronNET.Core ](https://www.nuget.org/packages/ElectronNET.Core.API/) | [![NuGet](https://img.shields.io/nuget/v/ElectronNET.Core.API.svg?style=flat-square) ElectronNET.Core.API ](https://www.nuget.org/packages/ElectronNET.Core.API/) | [![NuGet](https://img.shields.io/nuget/v/ElectronNET.Core.AspNet.svg?style=flat-square) ElectronNET.Core.AspNet ](https://www.nuget.org/packages/ElectronNET.Core.AspNet/)
2019-05-22 00:54:50 +02:00
2025-10-14 06:22:42 +02:00
## 🛠 Requirements to Run
2025-10-14 06:22:42 +02:00
Our API uses .NET 6/8, so our
Also you should have installed:
* .NET 6/8 or later
* OS
minimum base OS is the same as [.NET 6](https://github.com/dotnet/core/blob/main/release-notes/6.0/supported-os.md) / [.NET 8](https://github.com/dotnet/core/blob/main/release-notes/8.0/supported-os.md).
* NodeJS (at least [Version 22.x](https://nodejs.org))
2020-05-03 00:57:37 +02:00
2023-04-03 09:53:56 +02:00
2025-10-14 06:22:42 +02:00
## 👩‍🏫 Usage with ASP.Net
2017-10-17 23:48:02 +02:00
2025-10-14 06:22:42 +02:00
- Create a new ASP.Net Core project
- Install the following two nuget packages:
2017-10-17 23:48:02 +02:00
2023-04-03 09:53:56 +02:00
```ps1
2025-10-14 06:22:42 +02:00
PM> Install-Package ElectronNET.Core
PM> Install-Package ElectronNET.Core.AspNet
2023-03-30 09:38:19 +02:00
```
2025-10-14 06:22:42 +02:00
### Enable Electron.NET on Startup
To do so, use the `UseElectron` extension method on a `WebApplicationBuilder`, an `IWebHostBuilder` or any descendants.
2023-03-30 09:38:19 +02:00
2025-10-14 06:22:42 +02:00
> [!NOTE]
> 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.
2023-03-24 14:16:14 +01:00
### Program.cs
```csharp
using ElectronNET.API;
using ElectronNET.API.Entities;
2025-10-14 06:22:42 +02:00
public static void Main(string[] args)
{
WebHost.CreateDefaultBuilder(args)
.UseElectron(args, ElectronAppReady)
.UseStartup<Startup>()
.Build()
.Run();
}
2023-03-24 14:16:14 +01:00
2025-10-14 06:22:42 +02:00
public static async Task ElectronAppReady()
{
var browserWindow = await Electron.WindowManager.CreateWindowAsync(
new BrowserWindowOptions { Show = false });
2023-03-24 14:16:14 +01:00
2025-10-14 06:22:42 +02:00
browserWindow.OnReadyToShow += () => browserWindow.Show();
}
2023-03-24 14:16:14 +01:00
```
2025-10-14 06:22:42 +02:00
## 🚀 Starting and Debugging the Application
2017-10-18 22:58:01 +02:00
2025-10-14 06:22:42 +02:00
Just press F5 in Visual Studio or use dotnet for debugging.
2017-10-18 22:58:01 +02:00
2020-05-02 23:55:56 +02:00
2023-03-30 09:38:19 +02:00
## 📔 Usage of the Electron API
2017-10-18 22:58:01 +02:00
2025-10-15 22:12:29 +02:00
A complete documentation is available on the Wiki.
2017-10-18 22:58:01 +02:00
2017-11-10 03:25:28 +01:00
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](https://www.youtube.com/watch?v=nuM6AojRFHk)
2025-10-15 22:12:29 +02:00
> [!NOTE]
> The video hasn't been updated for the changes in ElectronNET.Core, so it is partially outdated.
2017-10-18 22:58:01 +02:00
2023-03-24 14:16:14 +01:00
2017-11-07 21:19:28 +01:00
2020-05-03 00:54:30 +02:00
## 👨‍💻 Authors
2020-05-03 00:50:04 +02:00
2023-03-30 09:38:19 +02:00
* **[Gregor Biswanger](https://github.com/GregorBiswanger)** - (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](http://www.cross-platform-blog.com) - Twitter [@BFreakout](https://www.twitter.com/BFreakout)
* **[Dr. Florian Rappl](https://github.com/FlorianRappl)** - Software Developer - from Munich, Germany. Microsoft MVP & Web Geek. - [The Art of Micro Frontends](https://microfrontends.art) - [Homepage](https://florian-rappl.de) - Twitter [@florianrappl](https://twitter.com/florianrappl)
2025-10-14 06:22:42 +02:00
* [**softworkz**](https://github.com/softworkz) - full range developer - likes to start where others gave up - MS MVP alumni and Munich citizen as well
2023-03-30 09:38:19 +02:00
* **[Robert Muehsig](https://github.com/robertmuehsig)** - Software Developer - from Dresden, Germany, now living & working in Switzerland. Microsoft MVP & Web Geek. - [codeinside Blog](https://blog.codeinside.eu) - Twitter [@robert0muehsig](https://twitter.com/robert0muehsig)
2020-05-03 00:50:04 +02:00
See also the list of [contributors](https://github.com/ElectronNET/Electron.NET/graphs/contributors) who participated in this project.
2020-05-03 00:54:30 +02:00
## 🙋‍♀️🙋‍♂ Contributing
2023-03-30 09:38:19 +02:00
2020-05-03 00:50:04 +02:00
Feel free to submit a pull request if you find any bugs (to see a list of active issues, visit the [Issues section](https://github.com/ElectronNET/Electron.NET/issues).
Please make sure all commits are properly documented.
2017-11-04 23:26:27 +01:00
2020-05-03 00:54:30 +02:00
## 🙏 Donate
2019-05-22 01:48:30 +02:00
2019-05-22 01:52:04 +02:00
We do this open source work in our free time. If you'd like us to invest more time on it, please [donate](https://donorbox.org/electron-net). Donation can be used to increase some issue priority. Thank you!
2019-05-22 01:48:30 +02:00
2020-05-03 00:57:37 +02:00
[![donate](https://img.shields.io/badge/Donate-Donorbox-green.svg)](https://donorbox.org/electron-net)
2023-03-30 09:38:19 +02:00
Alternatively, consider using a GitHub sponsorship for the core maintainers:
- [Gregor Biswanger](https://github.com/sponsors/GregorBiswanger)
- [Florian Rappl](https://github.com/sponsors/FlorianRappl)
Any support appreciated! 🍻
2020-05-03 00:54:30 +02:00
## 🎉 License
2023-03-30 09:38:19 +02:00
MIT-licensed. See [LICENSE](./LICENSE) for details.
2017-10-03 23:37:46 +02:00
2017-10-24 22:29:13 +02:00
**Enjoy!**
2023-03-24 14:16:14 +01:00
2019-05-23 16:41:19 +02:00
2019-05-31 09:12:07 -07:00