ElectronNET.CLI 0.0.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package ElectronNET.CLI --version 0.0.3                
NuGet\Install-Package ElectronNET.CLI -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.CLI" Version="0.0.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ElectronNET.CLI --version 0.0.3                
#r "nuget: ElectronNET.CLI, 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.CLI as a Cake Addin
#addin nuget:?package=ElectronNET.CLI&version=0.0.3

// Install ElectronNET.CLI as a Cake Tool
#tool nuget:?package=ElectronNET.CLI&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!

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
23.6.2 20,384 2/15/2024
23.6.2-alpha-13 455 4/3/2023
23.6.2-alpha-12 288 4/3/2023
23.6.2-alpha.71 61 2/15/2024
23.6.2-alpha.70 71 2/15/2024
23.6.2-alpha.68 70 2/15/2024
23.6.2-alpha.14 96 4/3/2023
23.6.1 24,803 3/27/2023
13.5.1 64,526 7/8/2021
11.5.1 17,908 1/21/2021
9.31.2 23,773 7/6/2020
9.31.1 2,252 6/12/2020
8.31.2 2,951 5/11/2020
8.31.1 1,634 5/1/2020
7.30.2 9,291 12/1/2019
5.30.1 2,976 10/28/2019
5.30.0-beta 503 10/14/2019
5.22.14 6,740 7/29/2019
5.22.13 1,955 7/1/2019
5.22.12 2,762 5/20/2019
0.0.11 6,230 12/30/2018
0.0.10 1,874 12/5/2018
0.0.9 25,374 2/19/2018
0.0.8 1,528 2/14/2018
0.0.7 3,188 11/7/2017
0.0.6 1,240 11/5/2017
0.0.5 1,361 10/27/2017
0.0.4 1,030 10/26/2017
0.0.3 1,240 10/25/2017
0.0.2 1,069 10/18/2017
0.0.1 2,271 10/17/2017