mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-02-04 05:34:51 +00:00
Updated readme
This commit is contained in:
91
README.md
91
README.md
@@ -2,43 +2,40 @@
|
||||
|
||||
[](https://donorbox.org/electron-net) [](https://gitter.im/ElectronNET/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [](https://github.com/ElectronNET/Electron.NET/actions/workflows/ci.yml)
|
||||
|
||||
# Electron.Net Core is here!
|
||||
# Electron.NET Core is here!
|
||||
|
||||
## A Complete Transformation
|
||||
|
||||
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.
|
||||
`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.
|
||||
|
||||
Read more: [**What's New in ElectronNET.Core**](wiki/What's-New)
|
||||
|
||||
|
||||
Build cross platform desktop applications with .NET 6/8 - from console apps to ASP.Net Core (Razor Pages, MVC) to Blazor
|
||||
Read more: [**What's New in `ElectronNET.Core`**](https://github.com/ElectronNET/Electron.NET/wiki/What's-New)
|
||||
|
||||
Build cross platform desktop applications with .NET 6/8/10 - from console apps to ASP.NET Core (Razor Pages, MVC) to Blazor.
|
||||
|
||||
## Wait - how does that work exactly?
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
## 📦 NuGet
|
||||
|
||||
[ ElectronNET.Core ](https://www.nuget.org/packages/ElectronNET.Core.API/) | [ ElectronNET.Core.API ](https://www.nuget.org/packages/ElectronNET.Core.API/) | [ ElectronNET.Core.AspNet ](https://www.nuget.org/packages/ElectronNET.Core.AspNet/)
|
||||
|
||||
* ElectronNET.Core: [](https://www.nuget.org/packages/ElectronNET.Core.API/)
|
||||
* ElectronNET.Core.API: [](https://www.nuget.org/packages/ElectronNET.Core.API/)
|
||||
* ElectronNET.Core.AspNet: [](https://www.nuget.org/packages/ElectronNET.Core.AspNet/)
|
||||
|
||||
## 🛠 Requirements to Run
|
||||
|
||||
Our API uses .NET 6/8, so our
|
||||
You should have installed:
|
||||
|
||||
Also you should have installed:
|
||||
* .NET 6/8 or later.
|
||||
* The 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).
|
||||
* Node.JS using at least [Version 22.x](https://nodejs.org).
|
||||
|
||||
* .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))
|
||||
## 👩🏫 Usage with ASP.NET
|
||||
|
||||
|
||||
## 👩🏫 Usage with ASP.Net
|
||||
|
||||
- Create a new ASP.Net Core project
|
||||
- Install the following two nuget packages:
|
||||
- Create a new ASP.NET Core project
|
||||
- Install the following two NuGet packages:
|
||||
|
||||
```ps1
|
||||
dotnet add package ElectronNET.Core
|
||||
@@ -46,14 +43,16 @@ dotnet add package ElectronNET.Core
|
||||
dotnet add package ElectronNET.Core.AspNet
|
||||
```
|
||||
|
||||
### Enable Electron.NET on Startup
|
||||
### Classic ASP.NET Core
|
||||
|
||||
#### Enable Electron.NET on Startup
|
||||
|
||||
To do so, use the `UseElectron` extension method on a `WebApplicationBuilder`, an `IWebHostBuilder` or any descendants.
|
||||
|
||||
> [!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.
|
||||
|
||||
### Program.cs
|
||||
#### Program.cs
|
||||
|
||||
```csharp
|
||||
using ElectronNET.API;
|
||||
@@ -68,7 +67,7 @@ using ElectronNET.API.Entities;
|
||||
.Run();
|
||||
}
|
||||
|
||||
public static async Task ElectronAppReady()
|
||||
public static async Task ElectronAppReady()
|
||||
{
|
||||
var browserWindow = await Electron.WindowManager.CreateWindowAsync(
|
||||
new BrowserWindowOptions { Show = false });
|
||||
@@ -77,11 +76,46 @@ using ElectronNET.API.Entities;
|
||||
}
|
||||
```
|
||||
|
||||
### Minimal API Example
|
||||
|
||||
For a minimal API you can use:
|
||||
|
||||
```csharp
|
||||
using ElectronNET;
|
||||
using ElectronNET.API;
|
||||
using ElectronNET.API.Entities;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
builder.Services.AddRazorPages();
|
||||
builder.Services.AddElectron(); // <- might be useful to set up DI
|
||||
|
||||
builder.UseElectron(args, async () =>
|
||||
{
|
||||
var browserWindow = await Electron.WindowManager.CreateWindowAsync(
|
||||
new BrowserWindowOptions { Show = false, AutoHideMenuBar = true });
|
||||
|
||||
browserWindow.OnReadyToShow += () => browserWindow.Show();
|
||||
});
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (!app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseExceptionHandler("/Error");
|
||||
}
|
||||
|
||||
app.UseStaticFiles();
|
||||
app.UseRouting();
|
||||
app.UseAuthorization();
|
||||
app.MapRazorPages();
|
||||
app.Run();
|
||||
```
|
||||
|
||||
## 🚀 Starting and Debugging the Application
|
||||
|
||||
Just press F5 in Visual Studio or use dotnet for debugging.
|
||||
|
||||
Just press `F5` in Visual Studio or use dotnet for debugging.
|
||||
|
||||
## 📔 Usage of the Electron API
|
||||
|
||||
@@ -92,13 +126,11 @@ In this YouTube video, we show you how you can create a new project, use the Ele
|
||||
> [!NOTE]
|
||||
> The video hasn't been updated for the changes in ElectronNET.Core, so it is partially outdated.
|
||||
|
||||
|
||||
|
||||
## 👨💻 Authors
|
||||
|
||||
* **[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)
|
||||
* [**softworkz**](https://github.com/softworkz) - full range developer - likes to start where others gave up - MS MVP alumni and Munich citizen as well
|
||||
* **[softworkz](https://github.com/softworkz)** - Full Range Developer - likes to start where others gave up. MS MVP alumni and Munich citizen as well.
|
||||
* **[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)
|
||||
|
||||
See also the list of [contributors](https://github.com/ElectronNET/Electron.NET/graphs/contributors) who participated in this project.
|
||||
@@ -108,7 +140,6 @@ See also the list of [contributors](https://github.com/ElectronNET/Electron.NET/
|
||||
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.
|
||||
|
||||
|
||||
## 🙏 Donate
|
||||
|
||||
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!
|
||||
@@ -127,6 +158,4 @@ Any support appreciated! 🍻
|
||||
MIT-licensed. See [LICENSE](./LICENSE) for details.
|
||||
|
||||
**Enjoy!**
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user