diff --git a/ElectronNET.CLI/Commands/BuildCommand.cs b/ElectronNET.CLI/Commands/BuildCommand.cs index 720b509..9f644f1 100644 --- a/ElectronNET.CLI/Commands/BuildCommand.cs +++ b/ElectronNET.CLI/Commands/BuildCommand.cs @@ -22,7 +22,8 @@ namespace ElectronNET.CLI.Commands Console.WriteLine("Executing dotnet publish in this directory: " + tempPath); - ProcessHelper.CmdExecute("dotnet publish -r win10-x64 --output " + Path.Combine(tempPath, "bin"), Directory.GetCurrentDirectory()); + string tempBinPath = Path.Combine(tempPath, "bin"); + ProcessHelper.CmdExecute($"dotnet publish -r win10-x64 --output \"{tempBinPath}\"", Directory.GetCurrentDirectory()); if (Directory.Exists(tempPath) == false) { diff --git a/ElectronNET.CLI/Commands/StartElectronCommand.cs b/ElectronNET.CLI/Commands/StartElectronCommand.cs index 014e09c..c0e4fa2 100644 --- a/ElectronNET.CLI/Commands/StartElectronCommand.cs +++ b/ElectronNET.CLI/Commands/StartElectronCommand.cs @@ -40,9 +40,14 @@ namespace ElectronNET.CLI.Commands aspCoreProjectPath = Directory.GetCurrentDirectory(); } - string currentAssemblyPath = AppDomain.CurrentDomain.BaseDirectory; - string tempPath = Path.Combine(currentAssemblyPath, "Host"); - ProcessHelper.CmdExecute("dotnet publish -r win10-x64 --output " + Path.Combine(tempPath, "bin"), aspCoreProjectPath); + string tempPath = Path.Combine(aspCoreProjectPath, "obj", "Host"); + if (Directory.Exists(tempPath) == false) + { + Directory.CreateDirectory(tempPath); + } + + string tempBinPath = Path.Combine(tempPath, "bin"); + ProcessHelper.CmdExecute($"dotnet publish -r win10-x64 --output \"{tempBinPath}\"", aspCoreProjectPath); EmbeddedFileHelper.DeployEmbeddedFile(tempPath, "main.js"); EmbeddedFileHelper.DeployEmbeddedFile(tempPath, "package.json"); @@ -52,7 +57,7 @@ namespace ElectronNET.CLI.Commands ProcessHelper.CmdExecute("npm install", tempPath); ProcessHelper.CmdExecute("npm install electron@1.7.8", tempPath); - ProcessHelper.CmdExecute(@"electron.cmd ""..\..\main.js""", Path.Combine(tempPath, "node_modules", ".bin")); + ProcessHelper.CmdExecute(@"electron.cmd ""..\..\main.js""", Path.Combine(tempPath, "node_modules", ".bin"), false, false); return true; }); diff --git a/ElectronNET.CLI/ProcessHelper.cs b/ElectronNET.CLI/ProcessHelper.cs index d4c3c1d..3263ba3 100644 --- a/ElectronNET.CLI/ProcessHelper.cs +++ b/ElectronNET.CLI/ProcessHelper.cs @@ -5,7 +5,7 @@ namespace ElectronNET.CLI { public class ProcessHelper { - public static void CmdExecute(string command, string workingDirectoryPath, bool output = true) + public static void CmdExecute(string command, string workingDirectoryPath, bool output = true, bool waitForExit = true) { using (Process cmd = new Process()) { @@ -21,7 +21,11 @@ namespace ElectronNET.CLI cmd.StandardInput.WriteLine(command); cmd.StandardInput.Flush(); cmd.StandardInput.Close(); - cmd.WaitForExit(); + + if(waitForExit) + { + cmd.WaitForExit(); + } if (output) { diff --git a/ElectronNET.Host/main.js b/ElectronNET.Host/main.js index 738ff02..daadd08 100644 --- a/ElectronNET.Host/main.js +++ b/ElectronNET.Host/main.js @@ -10,7 +10,7 @@ app.on('ready', () => { // run server // ToDo: The .exe name may vary. The most simple solution would be to locate the first .exe in the given directory - var apipath = path.join(__dirname, '\\bin\\ElectronNET.WebApp.exe /electronized=true'); + var apipath = path.join(__dirname, '\\bin\\ElectronNET.WebApp.exe'); apiProcess = process(apipath); apiProcess.stdout.on('data', (data) => { diff --git a/ElectronNET.WebApp/Program.cs b/ElectronNET.WebApp/Program.cs index d7b6ca0..e083e85 100644 --- a/ElectronNET.WebApp/Program.cs +++ b/ElectronNET.WebApp/Program.cs @@ -18,20 +18,20 @@ namespace ElectronNET.WebApp { // ToDo: Maybe add a "electronized" args check here? // this is the electron case! - if (args.Length > 0) - { - Console.WriteLine("Test Switch for Electron detection: " + args[0]); + //if (args.Length > 0) + //{ + //Console.WriteLine("Test Switch for Electron detection: " + args[0]); return WebHost.CreateDefaultBuilder(args) .UseContentRoot(AppDomain.CurrentDomain.BaseDirectory) .UseStartup() .Build(); - } - else - { - return WebHost.CreateDefaultBuilder(args) - .UseStartup() - .Build(); - } + //} + //else + //{ + // return WebHost.CreateDefaultBuilder(args) + // .UseStartup() + // .Build(); + //} // this didn't work... its too late, idk... //var builder = WebHost.CreateDefaultBuilder(args); diff --git a/ElectronNET.sln b/ElectronNET.sln index c7fc117..5871b73 100644 --- a/ElectronNET.sln +++ b/ElectronNET.sln @@ -27,6 +27,7 @@ Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "ElectronNET.Host", "Electro Release.AspNetCompiler.FixedNames = "false" Release.AspNetCompiler.Debug = "False" VWDPort = "56840" + SlnRelativePath = "ElectronNET.Host\" EndProjectSection EndProject Global