mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-09-22 23:15:25 +00:00
This commit is contained in:
@@ -49,7 +49,13 @@ namespace ElectronNET.CLI.Commands
|
||||
|
||||
Console.WriteLine($"Build ASP.NET Core App for {platformInfo.NetCorePublishRid}...");
|
||||
|
||||
ProcessHelper.CmdExecute($"dotnet publish -r {platformInfo.NetCorePublishRid} --output \"{tempBinPath}\"", Directory.GetCurrentDirectory());
|
||||
var resultCode = ProcessHelper.CmdExecute($"dotnet publish -r {platformInfo.NetCorePublishRid} --output \"{tempBinPath}\"", Directory.GetCurrentDirectory());
|
||||
|
||||
if (resultCode != 0)
|
||||
{
|
||||
Console.WriteLine("Error occured during dotnet publish.");
|
||||
return false;
|
||||
}
|
||||
|
||||
DeployEmbeddedElectronFiles.Do(tempPath);
|
||||
|
||||
|
||||
@@ -51,7 +51,13 @@ namespace ElectronNET.CLI.Commands
|
||||
var platformInfo = GetTargetPlatformInformation.Do(string.Empty);
|
||||
|
||||
string tempBinPath = Path.Combine(tempPath, "bin");
|
||||
ProcessHelper.CmdExecute($"dotnet publish -r {platformInfo.NetCorePublishRid} --output \"{tempBinPath}\"", aspCoreProjectPath);
|
||||
var resultCode = ProcessHelper.CmdExecute($"dotnet publish -r {platformInfo.NetCorePublishRid} --output \"{tempBinPath}\"", aspCoreProjectPath);
|
||||
|
||||
if (resultCode != 0)
|
||||
{
|
||||
Console.WriteLine("Error occured during dotnet publish.");
|
||||
return false;
|
||||
}
|
||||
|
||||
DeployEmbeddedElectronFiles.Do(tempPath);
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace ElectronNET.CLI
|
||||
{
|
||||
public class ProcessHelper
|
||||
{
|
||||
public static void CmdExecute(string command, string workingDirectoryPath, bool output = true, bool waitForExit = true)
|
||||
public static int CmdExecute(string command, string workingDirectoryPath, bool output = true, bool waitForExit = true)
|
||||
{
|
||||
using (Process cmd = new Process())
|
||||
{
|
||||
@@ -28,10 +28,21 @@ namespace ElectronNET.CLI
|
||||
cmd.StartInfo.CreateNoWindow = true;
|
||||
cmd.StartInfo.UseShellExecute = false;
|
||||
cmd.StartInfo.WorkingDirectory = workingDirectoryPath;
|
||||
|
||||
int returnCode = 0;
|
||||
|
||||
if (output)
|
||||
{
|
||||
cmd.OutputDataReceived += (s, e) => Console.WriteLine(e.Data);
|
||||
cmd.ErrorDataReceived += (s, e) => Console.WriteLine(e.Data);
|
||||
cmd.ErrorDataReceived += (s, e) =>
|
||||
{
|
||||
// we can't just use cmd.ExitCode, because
|
||||
// we delegate it to cmd.exe, which runs fine
|
||||
// but we can catch any error here and return
|
||||
// 1 if something fails
|
||||
returnCode = 1;
|
||||
Console.WriteLine(e.Data);
|
||||
};
|
||||
}
|
||||
|
||||
cmd.Start();
|
||||
@@ -46,6 +57,8 @@ namespace ElectronNET.CLI
|
||||
{
|
||||
cmd.WaitForExit();
|
||||
}
|
||||
|
||||
return returnCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
10
buildAll.cmd
10
buildAll.cmd
@@ -22,9 +22,9 @@ dotnet "../ElectronNET.CLI/bin/Debug/netcoreapp2.0/dotnet-electronize.dll" build
|
||||
echo "-- linux (dev-build)"
|
||||
dotnet "../ElectronNET.CLI/bin/Debug/netcoreapp2.0/dotnet-electronize.dll" build linux
|
||||
|
||||
REM Be aware, that for non-electronnet-dev environments the correct
|
||||
REM invoke command would be dotnet electronize ...
|
||||
:: Be aware, that for non-electronnet-dev environments the correct
|
||||
:: invoke command would be dotnet electronize ...
|
||||
|
||||
REM Not supported on Windows Systems, because of SymLinks...
|
||||
REM echo "-- osx"
|
||||
REM dotnet electronize build osx
|
||||
:: Not supported on Windows Systems, because of SymLinks...
|
||||
:: echo "-- osx"
|
||||
:: dotnet electronize build osx
|
||||
|
||||
Reference in New Issue
Block a user