osx for aspnet?

This commit is contained in:
Robert Muehsig
2017-10-08 23:22:20 +02:00
parent b1ad790c41
commit 4903384bd4
2 changed files with 31 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
namespace ElectronNET.CLI.Commands
@@ -16,14 +17,28 @@ namespace ElectronNET.CLI.Commands
{
return Task.Run(() =>
{
Console.WriteLine("Build Windows Application...");
Console.WriteLine("Build Electron Application...");
string tempPath = Path.Combine(Directory.GetCurrentDirectory(), "obj", "desktop");
Console.WriteLine("Executing dotnet publish in this directory: " + tempPath);
string tempBinPath = Path.Combine(tempPath, "bin");
ProcessHelper.CmdExecute($"dotnet publish -r win10-x64 --output \"{tempBinPath}\"", Directory.GetCurrentDirectory());
bool isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
if (isWindows)
{
Console.WriteLine("Build ASP.NET Core App for Windows...");
ProcessHelper.CmdExecute($"dotnet publish -r win10-x64 --output \"{tempBinPath}\"", Directory.GetCurrentDirectory());
}
else
{
Console.WriteLine("Build ASP.NET Core App for OSX...");
// ToDo: Linux... (or maybe via an argument, but this is just for development)
ProcessHelper.CmdExecute($"dotnet publish -r osx-x64 --output \"{tempBinPath}\"", Directory.GetCurrentDirectory());
}
if (Directory.Exists(tempPath) == false)
{

View File

@@ -1,5 +1,6 @@
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace ElectronNET.CLI
{
@@ -9,7 +10,19 @@ namespace ElectronNET.CLI
{
using (Process cmd = new Process())
{
cmd.StartInfo.FileName = "cmd.exe";
bool isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
if (isWindows)
{
cmd.StartInfo.FileName = "cmd.exe";
}
else
{
// ToDo: Linux...
cmd.StartInfo.FileName = "bash";
}
cmd.StartInfo.RedirectStandardInput = true;
cmd.StartInfo.RedirectStandardOutput = true;
cmd.StartInfo.CreateNoWindow = true;