ElectronNET.API 0.0.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package ElectronNET.API --version 0.0.3
NuGet\Install-Package ElectronNET.API -Version 0.0.3
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ElectronNET.API" Version="0.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ElectronNET.API --version 0.0.3
#r "nuget: ElectronNET.API, 0.0.3"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ElectronNET.API as a Cake Addin
#addin nuget:?package=ElectronNET.API&version=0.0.3

// Install ElectronNET.API as a Cake Tool
#tool nuget:?package=ElectronNET.API&version=0.0.3

Electron.NET Logo

AppVeyor (Win/Linux): Build status

Travis-CI (Win/OSX/Linux): Build Status

Build cross platform desktop apps with .NET Core 2.0 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.

Contributing

Feel free to submit a pull request if you find any bugs (to see a list of active issues, visit the Issues section. Please make sure all commits are properly documented.

Authors

  • Gregor Biswanger - (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 - Twitter @BFreakout
  • Robert Muehsig - Software Developer - from Dresden, Germany, now living & working in Switzerland. Microsoft MVP & Web Geek. - codeinside Blog - Twitter @robert0muehsig

See also the list of contributors who participated in this project.

License

MIT-licensed

Enjoy!

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (12)

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 (9)

Showing the top 5 popular GitHub repositories that depend on ElectronNET.API:

Repository Stars
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
anobaka/InsideWorld
二次元老司机专用的本地媒体文件管理器,支持管理和处理音视频、本子、图集、小说、哔哩哔哩视频、游戏甚至mod等各类资源
Texnomic/SecureDNS
Secure, Modern, Fully-Featured, All-In-One Cross-Architecture & Cross-Platform DNS Server Using .NET 7.0
Version Downloads Last updated
23.6.2 5,659 2/15/2024
23.6.2-alpha-13 1,438 4/3/2023
23.6.2-alpha-12 129 4/3/2023
23.6.2-alpha.71 67 2/15/2024
23.6.2-alpha.70 54 2/15/2024
23.6.2-alpha.68 54 2/15/2024
23.6.2-alpha.14 130 4/3/2023
23.6.1 45,972 3/27/2023
13.5.1 108,025 7/8/2021
11.5.1 24,440 1/21/2021
9.31.2 98,947 7/6/2020
9.31.1 5,357 6/12/2020
8.31.2 10,998 5/11/2020
8.31.1 2,131 5/1/2020
7.30.2 24,881 12/1/2019
5.30.1 13,436 10/28/2019
5.30.0-beta 571 10/14/2019
5.22.14 9,181 7/29/2019
5.22.13 6,691 7/1/2019
5.22.12 8,194 5/20/2019
0.0.11 10,432 12/30/2018
0.0.10 1,759 12/5/2018
0.0.9 17,728 2/19/2018
0.0.7 4,049 11/7/2017
0.0.6 5,008 11/5/2017
0.0.5 2,813 10/27/2017
0.0.4 1,041 10/26/2017
0.0.3 1,163 10/25/2017
0.0.2 1,179 10/18/2017
0.0.1 1,435 10/17/2017