Skip to content

Commit b6417d0

Browse files
Implement new command: electronize build /target win /PublishReadyToRun false #395 - Add self contained app #387
1 parent 6f1f7cb commit b6417d0

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

ElectronNET.CLI/Commands/BuildCommand.cs

+12-1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public BuildCommand(string[] args)
4242
private string _paramPackageJson = "package-json";
4343
private string _paramForceNodeInstall = "install-modules";
4444
private string _manifest = "manifest";
45+
private string _paramPublishReadyToRun = "PublishReadyToRun";
4546

4647
public Task<bool> ExecuteAsync()
4748
{
@@ -95,7 +96,17 @@ public Task<bool> ExecuteAsync()
9596

9697
Console.WriteLine($"Build ASP.NET Core App for {platformInfo.NetCorePublishRid} under {configuration}-Configuration...");
9798

98-
var resultCode = ProcessHelper.CmdExecute($"dotnet publish -r {platformInfo.NetCorePublishRid} -c {configuration} --output \"{tempBinPath}\" /p:PublishReadyToRun=true --no-self-contained", Directory.GetCurrentDirectory());
99+
string publishReadyToRun = "/p:PublishReadyToRun=";
100+
if (parser.Arguments.ContainsKey(_paramPublishReadyToRun))
101+
{
102+
publishReadyToRun += parser.Arguments[_paramPublishReadyToRun][0];
103+
}
104+
else
105+
{
106+
publishReadyToRun += "true";
107+
}
108+
109+
var resultCode = ProcessHelper.CmdExecute($"dotnet publish -r {platformInfo.NetCorePublishRid} -c {configuration} --output \"{tempBinPath}\" {publishReadyToRun} --self-contained", Directory.GetCurrentDirectory());
99110

100111
if (resultCode != 0)
101112
{

ElectronNET.CLI/Commands/StartElectronCommand.cs

+12-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public StartElectronCommand(string[] args)
2626
private string _arguments = "args";
2727
private string _manifest = "manifest";
2828
private string _clearCache = "clear-cache";
29+
private string _paramPublishReadyToRun = "PublishReadyToRun";
2930

3031
public Task<bool> ExecuteAsync()
3132
{
@@ -62,9 +63,19 @@ public Task<bool> ExecuteAsync()
6263
string tempBinPath = Path.Combine(tempPath, "bin");
6364
var resultCode = 0;
6465

66+
string publishReadyToRun = "/p:PublishReadyToRun=";
67+
if (parser.Arguments.ContainsKey(_paramPublishReadyToRun))
68+
{
69+
publishReadyToRun += parser.Arguments[_paramPublishReadyToRun][0];
70+
}
71+
else
72+
{
73+
publishReadyToRun += "true";
74+
}
75+
6576
if (parser != null && !parser.Arguments.ContainsKey("watch"))
6677
{
67-
resultCode = ProcessHelper.CmdExecute($"dotnet publish -r {platformInfo.NetCorePublishRid} --output \"{tempBinPath}\" /p:PublishReadyToRun=true --no-self-contained", aspCoreProjectPath);
78+
resultCode = ProcessHelper.CmdExecute($"dotnet publish -r {platformInfo.NetCorePublishRid} --output \"{tempBinPath}\" {publishReadyToRun} --no-self-contained", aspCoreProjectPath);
6879
}
6980

7081
if (resultCode != 0)

0 commit comments

Comments
 (0)