From cc7905a326f96e4ebc961aa92178ce3b5285aa93 Mon Sep 17 00:00:00 2001 From: Robert Muehsig Date: Thu, 19 Oct 2017 21:31:32 +0200 Subject: [PATCH] build obj per target --- ElectronNET.CLI/Commands/BuildCommand.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/ElectronNET.CLI/Commands/BuildCommand.cs b/ElectronNET.CLI/Commands/BuildCommand.cs index 757f05a..f4d309c 100644 --- a/ElectronNET.CLI/Commands/BuildCommand.cs +++ b/ElectronNET.CLI/Commands/BuildCommand.cs @@ -34,11 +34,6 @@ namespace ElectronNET.CLI.Commands } - string tempPath = Path.Combine(Directory.GetCurrentDirectory(), "obj", "desktop"); - - Console.WriteLine("Executing dotnet publish in this directory: " + tempPath); - - string tempBinPath = Path.Combine(tempPath, "bin"); string netCorePublishRid = string.Empty; string electronPackerPlatform = string.Empty; @@ -60,16 +55,19 @@ namespace ElectronNET.CLI.Commands default: if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { + desiredPlatform = "win"; netCorePublishRid = "win10-x64"; electronPackerPlatform = "win32"; } if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { + desiredPlatform = "osx"; netCorePublishRid = "osx-x64"; electronPackerPlatform = "darwin"; } if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { + desiredPlatform = "linux"; netCorePublishRid = "ubuntu-x64"; electronPackerPlatform = "linux"; } @@ -77,6 +75,13 @@ namespace ElectronNET.CLI.Commands break; } + + string tempPath = Path.Combine(Directory.GetCurrentDirectory(), "obj", "desktop", desiredPlatform); + + Console.WriteLine("Executing dotnet publish in this directory: " + tempPath); + + string tempBinPath = Path.Combine(tempPath, "bin"); + Console.WriteLine($"Build ASP.NET Core App for {netCorePublishRid}..."); ProcessHelper.CmdExecute($"dotnet publish -r {netCorePublishRid} --output \"{tempBinPath}\"", Directory.GetCurrentDirectory()); @@ -122,7 +127,7 @@ namespace ElectronNET.CLI.Commands } Console.WriteLine("Build Electron Desktop Application..."); - string buildPath = Path.Combine(Directory.GetCurrentDirectory(), "bin", "desktop"); + Console.WriteLine("Executing electron magic in this directory: " + buildPath); // ToDo: Need a solution for --asar support