diff --git a/ElectronNET.CLI/Commands/BuildCommand.cs b/ElectronNET.CLI/Commands/BuildCommand.cs index 8cd7ffd..4ca7120 100644 --- a/ElectronNET.CLI/Commands/BuildCommand.cs +++ b/ElectronNET.CLI/Commands/BuildCommand.cs @@ -42,6 +42,7 @@ namespace ElectronNET.CLI.Commands private string _paramPackageJson = "package-json"; private string _paramForceNodeInstall = "install-modules"; private string _manifest = "manifest"; + private string _paramPublishReadyToRun = "PublishReadyToRun"; public Task ExecuteAsync() { @@ -95,7 +96,17 @@ namespace ElectronNET.CLI.Commands Console.WriteLine($"Build ASP.NET Core App for {platformInfo.NetCorePublishRid} under {configuration}-Configuration..."); - var resultCode = ProcessHelper.CmdExecute($"dotnet publish -r {platformInfo.NetCorePublishRid} -c {configuration} --output \"{tempBinPath}\" /p:PublishReadyToRun=true --no-self-contained", Directory.GetCurrentDirectory()); + string publishReadyToRun = "/p:PublishReadyToRun="; + if (parser.Arguments.ContainsKey(_paramPublishReadyToRun)) + { + publishReadyToRun += parser.Arguments[_paramPublishReadyToRun][0]; + } + else + { + publishReadyToRun += "true"; + } + + var resultCode = ProcessHelper.CmdExecute($"dotnet publish -r {platformInfo.NetCorePublishRid} -c {configuration} --output \"{tempBinPath}\" {publishReadyToRun} --self-contained", Directory.GetCurrentDirectory()); if (resultCode != 0) { diff --git a/ElectronNET.CLI/Commands/StartElectronCommand.cs b/ElectronNET.CLI/Commands/StartElectronCommand.cs index 2340423..b72d7bd 100644 --- a/ElectronNET.CLI/Commands/StartElectronCommand.cs +++ b/ElectronNET.CLI/Commands/StartElectronCommand.cs @@ -26,6 +26,7 @@ namespace ElectronNET.CLI.Commands private string _arguments = "args"; private string _manifest = "manifest"; private string _clearCache = "clear-cache"; + private string _paramPublishReadyToRun = "PublishReadyToRun"; public Task ExecuteAsync() { @@ -62,9 +63,19 @@ namespace ElectronNET.CLI.Commands string tempBinPath = Path.Combine(tempPath, "bin"); var resultCode = 0; + string publishReadyToRun = "/p:PublishReadyToRun="; + if (parser.Arguments.ContainsKey(_paramPublishReadyToRun)) + { + publishReadyToRun += parser.Arguments[_paramPublishReadyToRun][0]; + } + else + { + publishReadyToRun += "true"; + } + if (parser != null && !parser.Arguments.ContainsKey("watch")) { - resultCode = ProcessHelper.CmdExecute($"dotnet publish -r {platformInfo.NetCorePublishRid} --output \"{tempBinPath}\" /p:PublishReadyToRun=true --no-self-contained", aspCoreProjectPath); + resultCode = ProcessHelper.CmdExecute($"dotnet publish -r {platformInfo.NetCorePublishRid} --output \"{tempBinPath}\" {publishReadyToRun} --no-self-contained", aspCoreProjectPath); } if (resultCode != 0)