diff --git a/ElectronNET.API/ElectronNET.API.csproj b/ElectronNET.API/ElectronNET.API.csproj
index 0dfc108..16d0aa4 100644
--- a/ElectronNET.API/ElectronNET.API.csproj
+++ b/ElectronNET.API/ElectronNET.API.csproj
@@ -5,6 +5,17 @@
true
..\artifacts
ElectronNET.API
+ Gregor Biswanger, Robert Muehsig
+
+ Electron.NET
+ https://github.com/GregorBiswanger/Electron.NET/blob/master/LICENSE
+ https://github.com/GregorBiswanger/Electron.NET/
+ Building cross platform electron based desktop apps with .NET Core and ASP.NET NET Core.
+This package contains the API to access the "native" electron API.
+ https://github.com/GregorBiswanger/Electron.NET/
+ electron aspnetcore
+ #0.0.1
+- alpha release
diff --git a/ElectronNET.CLI/Commands/BuildCommand.cs b/ElectronNET.CLI/Commands/BuildCommand.cs
index 06b8b05..757f05a 100644
--- a/ElectronNET.CLI/Commands/BuildCommand.cs
+++ b/ElectronNET.CLI/Commands/BuildCommand.cs
@@ -10,41 +10,77 @@ namespace ElectronNET.CLI.Commands
{
public const string COMMAND_NAME = "build";
public const string COMMAND_DESCRIPTION = "Build your Electron Application.";
- public const string COMMAND_ARGUMENTS = " from ASP.NET Core Project.";
+ public const string COMMAND_ARGUMENTS = " to build (default is current OS, possible values are: win,osx,linux)";
public static IList CommandOptions { get; set; } = new List();
+ private string[] _args;
+
+ public BuildCommand(string[] args)
+ {
+ _args = args;
+ }
+
public Task ExecuteAsync()
{
return Task.Run(() =>
{
Console.WriteLine("Build Electron Application...");
+ string desiredPlatform = "";
+
+ if (_args.Length > 0)
+ {
+ desiredPlatform = _args[0];
+ }
+
+
string tempPath = Path.Combine(Directory.GetCurrentDirectory(), "obj", "desktop");
Console.WriteLine("Executing dotnet publish in this directory: " + tempPath);
string tempBinPath = Path.Combine(tempPath, "bin");
- if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
- {
- Console.WriteLine("Build ASP.NET Core App for Windows...");
+ string netCorePublishRid = string.Empty;
+ string electronPackerPlatform = string.Empty;
- ProcessHelper.CmdExecute($"dotnet publish -r win10-x64 --output \"{tempBinPath}\"", Directory.GetCurrentDirectory());
+ switch (desiredPlatform)
+ {
+ case "win":
+ netCorePublishRid = "win10-x64";
+ electronPackerPlatform = "win32";
+ break;
+ case "osx":
+ netCorePublishRid = "osx-x64";
+ electronPackerPlatform = "darwin";
+ break;
+ case "linux":
+ netCorePublishRid = "ubuntu-x64";
+ electronPackerPlatform = "linux";
+ break;
+ default:
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+ {
+ netCorePublishRid = "win10-x64";
+ electronPackerPlatform = "win32";
+ }
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
+ {
+ netCorePublishRid = "osx-x64";
+ electronPackerPlatform = "darwin";
+ }
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+ {
+ netCorePublishRid = "ubuntu-x64";
+ electronPackerPlatform = "linux";
+ }
+
+ break;
}
- if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
- {
- Console.WriteLine("Build ASP.NET Core App for OSX...");
+ Console.WriteLine($"Build ASP.NET Core App for {netCorePublishRid}...");
- ProcessHelper.CmdExecute($"dotnet publish -r osx-x64 --output \"{tempBinPath}\"", Directory.GetCurrentDirectory());
- }
+ ProcessHelper.CmdExecute($"dotnet publish -r {netCorePublishRid} --output \"{tempBinPath}\"", Directory.GetCurrentDirectory());
- if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
- {
- Console.WriteLine("Build ASP.NET Core App for Linux (Ubuntu x64)...");
-
- ProcessHelper.CmdExecute($"dotnet publish -r ubuntu-x64 --output \"{tempBinPath}\"", Directory.GetCurrentDirectory());
- }
if (Directory.Exists(tempPath) == false)
{
@@ -90,26 +126,8 @@ namespace ElectronNET.CLI.Commands
Console.WriteLine("Executing electron magic in this directory: " + buildPath);
// ToDo: Need a solution for --asar support
- if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
- {
- Console.WriteLine("Package Electron App for Windows...");
-
- ProcessHelper.CmdExecute($"electron-packager . --platform=win32 --arch=x64 --out=\"{buildPath}\" --overwrite", tempPath);
- }
-
- if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
- {
- Console.WriteLine("Package Electron App for OSX...");
-
- ProcessHelper.CmdExecute($"electron-packager . --platform=darwin --arch=x64 --out=\"{buildPath}\" --overwrite", tempPath);
- }
-
- if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
- {
- Console.WriteLine("Package Electron App for Linux...");
-
- ProcessHelper.CmdExecute($"electron-packager . --platform=linux --arch=x64 --out=\"{buildPath}\" --overwrite", tempPath);
- }
+ Console.WriteLine($"Package Electron App for Platform {electronPackerPlatform}...");
+ ProcessHelper.CmdExecute($"electron-packager . --platform={electronPackerPlatform} --arch=x64 --out=\"{buildPath}\" --overwrite", tempPath);
Console.WriteLine("... done");
diff --git a/ElectronNET.CLI/Commands/InitCommand.cs b/ElectronNET.CLI/Commands/InitCommand.cs
index 08fffb9..96f348b 100644
--- a/ElectronNET.CLI/Commands/InitCommand.cs
+++ b/ElectronNET.CLI/Commands/InitCommand.cs
@@ -17,11 +17,32 @@ namespace ElectronNET.CLI.Commands
private const string ConfigName = "electron.manifest.json";
+ private string[] _args;
+
+ public InitCommand(string[] args)
+ {
+ _args = args;
+ }
+
public Task ExecuteAsync()
{
return Task.Run(() =>
{
- var currentDirectory = Directory.GetCurrentDirectory();
+ string aspCoreProjectPath = "";
+
+ if (_args.Length > 0)
+ {
+ if (Directory.Exists(_args[0]))
+ {
+ aspCoreProjectPath = _args[0];
+ }
+ }
+ else
+ {
+ aspCoreProjectPath = Directory.GetCurrentDirectory();
+ }
+
+ var currentDirectory = aspCoreProjectPath;
Console.WriteLine("Adding our config file to your project...");
diff --git a/ElectronNET.CLI/ElectronNET.CLI.csproj b/ElectronNET.CLI/ElectronNET.CLI.csproj
index eb487c8..1692636 100644
--- a/ElectronNET.CLI/ElectronNET.CLI.csproj
+++ b/ElectronNET.CLI/ElectronNET.CLI.csproj
@@ -10,6 +10,18 @@
..\artifacts
ElectronNET.CLI
1.0.0
+ Gregor Biswanger, Robert Muehsig
+ Electron.NET
+
+ Building cross platform electron based desktop apps with .NET Core and ASP.NET NET Core.
+This package contains the dotnet tooling to electronize your application.
+ https://github.com/GregorBiswanger/Electron.NET/blob/master/LICENSE
+ https://github.com/GregorBiswanger/Electron.NET/
+ https://github.com/GregorBiswanger/Electron.NET/
+ electron aspnetcore
+ #0.0.1
+- alpha release
+ https://raw.githubusercontent.com/GregorBiswanger/Electron.NET/master/assets/images/electron.net-logo-square.png
diff --git a/ElectronNET.CLI/Program.cs b/ElectronNET.CLI/Program.cs
index 63caac0..76936e9 100644
--- a/ElectronNET.CLI/Program.cs
+++ b/ElectronNET.CLI/Program.cs
@@ -28,10 +28,10 @@ namespace ElectronNET.CLI
command = new StartElectronCommand(args.Skip(1).ToArray());
break;
case BuildCommand.COMMAND_NAME:
- command = new BuildCommand();
+ command = new BuildCommand(args.Skip(1).ToArray());
break;
case InitCommand.COMMAND_NAME:
- command = new InitCommand();
+ command = new InitCommand(args.Skip(1).ToArray());
break;
case "--help":
case "--h":
diff --git a/ElectronNET.CLI/devCleanup.cmd b/ElectronNET.CLI/devCleanup.cmd
index 803ea4f..4f81c99 100644
--- a/ElectronNET.CLI/devCleanup.cmd
+++ b/ElectronNET.CLI/devCleanup.cmd
@@ -1,2 +1,2 @@
-rd /s /q %userprofile%\.nuget\packages\.tools\electronnet.cli 2>nul
-rd /s /q %userprofile%\.nuget\packages\electronnet.cli 2>nul
+rd /s /q %userprofile%\.nuget\packages\.tools\electronnet.cli
+rd /s /q %userprofile%\.nuget\packages\electronnet.cli
diff --git a/README.md b/README.md
index 4cf43d2..a2729b7 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,45 @@
[](https://github.com/GregorBiswanger/Electron.NET)
-[](https://ci.appveyor.com/project/robertmuehsig/electron-net/branch/cli-etc)
+Master: [](https://ci.appveyor.com/project/robertmuehsig/electron-net/branch/master)
Build cross platform desktop apps with .NET Core and ASP.NET NET Core.
+# Usage:
+
+* To communicate with the "native" (sort of native...) Electron API include the [ElectronNET.API NuGet package](https://www.nuget.org/packages/ElectronNET.API/) in your ASP.NET Core app.
+
+* For the tooling you will need your dotnet-electronize package [ElectronNET.CLI NuGet package](https://www.nuget.org/packages/ElectronNET.CLI/). This package __must__ be referenced in the .csproj like this:
+
+```
+
+
+
+```
+
+* Make sure you have node.js and on OSX/Ubuntu the electron-packager installed (via "sudo npm install electron-packager --global")
+* In your ASP.NET Core folder run:
+
+```
+ dotnet electronize init
+```
+
+* Now a electronnet.manifest.json should appear in your ASP.NET Core project
+* Now run the following:
+
+```
+ 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 a electron app under your /bin/desktop folder
+
## Dev Notes:
Currently there are two main projects and a "WebApp" that serves as a demo playground.
@@ -13,11 +49,7 @@ Currently there are two main projects and a "WebApp" that serves as a demo playg
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. If you change something you need to clear the nuget cache under this directory (because the version number doesn't change):
-
- %userprofile%\.nuget\packages
-
-The solution contains a NuGet.config which points to the artifacts directory, so we can just use the produced NuGet packages without uploading to NuGet.org.
+__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:__
@@ -27,16 +59,14 @@ The WebApp now has referenced the API NuGet package and via the .csproj referenc
-## Dev Notes: Usage
-Navigate to the WebApp folder and type this in a command prompt:
-
- dotnet electronize
-# Dev Notes: Dev Workflow (at least for the CLI extension is this a must)
+# 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 restore in the WebApp
* execute dotnet electronize
diff --git a/appveyor.yml b/appveyor.yml
index 1387a76..de58500 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -1,7 +1,4 @@
version: 1.0.{build}
-branches:
- only:
- - cli-etc
image: Visual Studio 2017
build_script:
- cmd: buildAll.cmd
diff --git a/assets/images/electron.net-logo-square.png b/assets/images/electron.net-logo-square.png
new file mode 100644
index 0000000..10d55eb
Binary files /dev/null and b/assets/images/electron.net-logo-square.png differ
diff --git a/buildReleaseNuGetPackages.cmd b/buildReleaseNuGetPackages.cmd
new file mode 100644
index 0000000..d5572dc
--- /dev/null
+++ b/buildReleaseNuGetPackages.cmd
@@ -0,0 +1,10 @@
+echo "Start building Electron.NET dev stack..."
+echo "Restore & Build API"
+cd ElectronNet.API
+dotnet restore
+dotnet pack /p:PackageVersion=0.0.1 --output %~dp0artifacts
+cd ..
+echo "Restore & Build API"
+cd ElectronNet.CLI
+dotnet restore
+dotnet pack /p:PackageVersion=0.0.1 --output %~dp0artifacts