ElectronNET.API
0.0.2
See the version list below for details.
dotnet add package ElectronNET.API --version 0.0.2
NuGet\Install-Package ElectronNET.API -Version 0.0.2
<PackageReference Include="ElectronNET.API" Version="0.0.2" />
paket add ElectronNET.API --version 0.0.2
#r "nuget: ElectronNET.API, 0.0.2"
// Install ElectronNET.API as a Cake Addin #addin nuget:?package=ElectronNET.API&version=0.0.2 // Install ElectronNET.API as a Cake Tool #tool nuget:?package=ElectronNET.API&version=0.0.2
Build cross platform desktop apps with .NET Core and ASP.NET NET Core.
Usage:
To activate and communicate with the "native" (sort of native...) Electron API include the ElectronNET.API NuGet package in your ASP.NET Core app.
PM> Install-Package ElectronNET.API
Program.cs
You start Electron.NET up with an UseElectron
WebHostBuilder-Extension.
public static IWebHost BuildWebHost(string[] args)
{
return WebHost.CreateDefaultBuilder(args)
.UseElectron(args)
.UseStartup<Startup>()
.Build();
}
Startup.cs
Open the Electron Window in the Startup.cs file:
public async void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseBrowserLink();
}
else
{
app.UseExceptionHandler("/Home/Error");
}
app.UseStaticFiles();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
// Open the Electron-Window here
await Electron.WindowManager.CreateWindowAsync();
}
Start the Application
For the tooling you will need your dotnet-electronize package ElectronNET.CLI NuGet package. This package must be referenced in the .csproj like this:
<ItemGroup>
<DotNetCliToolReference Include="ElectronNET.CLI" Version="*" />
</ItemGroup>
After you edited the .csproj-file, you need to restore your NuGet packages within your Project. Run the follwoing command in your ASP.NET Core folder:
dotnet restore
- Make sure you have node.js v8.6.0 and on OSX/Ubuntu the electron-packager installed (via "sudo npm install electron-packager --global")
At the first time, you need an Electron.NET Project initialization. Type the following command in your ASP.NET Core folder:
dotnet electronize init
- Now a electronnet.manifest.json should appear in your ASP.NET Core project
- Now run the following:
dotnet electronize start
Note
Only the first electronize start is slow. The next will go on faster.
Debug
Start your Electron.NET application with the Electron.NET CLI command. In Visual Studio attach to your running application instance. Go in the Debug Menu and click on Attach to Process.... Sort by your projectname on the right and select it on the list.
Usage of the Electron-API
A complete documentation will follow. Until then take a look in the source code of the sample application: ElectronNET.WebApp
Build
Here you need the Electron.NET CLI too. Type following command in your ASP.NET Core folder:
dotnet electronize build
In your default setting we just build the application for the OS you are running (Windows builds Windows, OSX builds OSX etc.), but this can be changed with:
dotnet electronize build win
dotnet electronize build osx
dotnet electronize build linux
The end result should be an electron app under your /bin/desktop folder.
Note
An OS X App can only be built on a host OS X platform.
Dev Notes:
Currently there are two main projects and a "WebApp" that serves as a demo playground.
- ElectronNET.API: Defines the Electron / .NET API bridge
- ElectronNET.CLI: Responsible for the dotnet "electronize" tooling.
Both projects create their own nuget package. The resulting nuget packages are saved under "/artifacts".
Currently the packages are just build with version 1.0.0 on your machine. NuGet might pick the wrong version from its own cache, so please read the dev notes if you want to develop!
ElectronNET.WebApp:
The WebApp now has referenced the API NuGet package and via the .csproj reference the CLI:
<ItemGroup>
<DotNetCliToolReference Include="ElectronNET.CLI" Version="*" />
</ItemGroup>
Dev Notes: Dev Workflow
(at least for the CLI extension)
- Change something in the CLI project
- rebuild the project (a nuget package should now appear in the /artifacts directory)
- make sure there is no ElectronNET.CLI package in your %userprofile%.nuget\packages cache with the same version
- execute dotnet restore in the WebApp
- execute dotnet electronize
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 is compatible. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
-
.NETCoreApp 2.0
- Microsoft.AspNetCore.Hosting.Abstractions (>= 2.0.0)
- SocketIoClientDotNet (>= 1.0.3)
NuGet packages (13)
Showing the top 5 NuGet packages that depend on ElectronNET.API:
Package | Downloads |
---|---|
NetModular.Lib.Host.Electron
NetModular host for Electron |
|
SDML.Lib
SDML.Lib |
|
TemiiCore.Lib.Host.Electron
Temiicore host for Electron |
|
BlazorMobile.ElectronNET
This package allow BlazorMobile to be compatible with an ElectronNET server-side Blazor application, so you can use the same project structure and interoping calls either on Mobile (BlazorMobile) and Desktop (ElectronNET) |
|
ElectronNET.Blazor
Building cross platform Electron-based apps with ASP.NET Core 3.0 and Blazor. NOTE: Install this package in your **Server-side** project. Blazor + Electron requires the "Blazor (ASP.NET Core Hosted)" project type and will not run in "standalone" Blazor. |
GitHub repositories (10)
Showing the top 5 popular GitHub repositories that depend on ElectronNET.API:
Repository | Stars |
---|---|
ChangemakerStudios/Papercut-SMTP
Papercut SMTP -- The Simple Desktop Email Server
|
|
iamoldli/NetModular
NetModular 是基于.Net Core 和 Vue.js 的业务模块化以及前后端分离的快速开发框架
|
|
Daddoon/BlazorMobile
Create full C# driven hybrid-apps for iOS, Android, UWP & Desktop with Blazor!
|
|
domialex/Sidekick
A Path of Exile helper
|
|
Texnomic/SecureDNS
Secure, Modern, Fully-Featured, All-In-One Cross-Architecture & Cross-Platform DNS Server Using .NET 8.0
|
Version | Downloads | Last updated |
---|---|---|
23.6.2 | 36,906 | 2/15/2024 |
23.6.2-alpha-13 | 1,593 | 4/3/2023 |
23.6.2-alpha-12 | 152 | 4/3/2023 |
23.6.2-alpha.71 | 83 | 2/15/2024 |
23.6.2-alpha.70 | 68 | 2/15/2024 |
23.6.2-alpha.68 | 68 | 2/15/2024 |
23.6.2-alpha.14 | 144 | 4/3/2023 |
23.6.1 | 56,930 | 3/27/2023 |
13.5.1 | 114,803 | 7/8/2021 |
11.5.1 | 25,194 | 1/21/2021 |
9.31.2 | 103,566 | 7/6/2020 |
9.31.1 | 5,510 | 6/12/2020 |
8.31.2 | 11,157 | 5/11/2020 |
8.31.1 | 2,179 | 5/1/2020 |
7.30.2 | 25,500 | 12/1/2019 |
5.30.1 | 13,729 | 10/28/2019 |
5.30.0-beta | 593 | 10/14/2019 |
5.22.14 | 9,338 | 7/29/2019 |
5.22.13 | 6,779 | 7/1/2019 |
5.22.12 | 8,243 | 5/20/2019 |
0.0.11 | 10,495 | 12/30/2018 |
0.0.10 | 1,788 | 12/5/2018 |
0.0.9 | 17,881 | 2/19/2018 |
0.0.7 | 4,119 | 11/7/2017 |
0.0.6 | 5,047 | 11/5/2017 |
0.0.5 | 2,860 | 10/27/2017 |
0.0.4 | 1,062 | 10/26/2017 |
0.0.3 | 1,196 | 10/25/2017 |
0.0.2 | 1,198 | 10/18/2017 |
0.0.1 | 1,534 | 10/17/2017 |