fix Build und Start Commands with new Temp-Folder "OBJ"

This commit is contained in:
Gregor Biswanger
2017-10-06 02:54:55 +02:00
parent 44138a81c9
commit 383e9cd3fa
6 changed files with 29 additions and 18 deletions

View File

@@ -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)
{

View File

@@ -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;
});

View File

@@ -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)
{

View File

@@ -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) => {

View File

@@ -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<Startup>()
.Build();
}
else
{
return WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.Build();
}
//}
//else
//{
// return WebHost.CreateDefaultBuilder(args)
// .UseStartup<Startup>()
// .Build();
//}
// this didn't work... its too late, idk...
//var builder = WebHost.CreateDefaultBuilder(args);

View File

@@ -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