From 4e1d4186c497aadfe0e346ac053ba76267663914 Mon Sep 17 00:00:00 2001 From: Mattias Gustavsson Date: Wed, 21 Apr 2021 11:56:58 +0200 Subject: [PATCH] SDA-3102 Added support for LAUNCH_ON_INSTALL installation parameter --- installer/win/WixSharpInstaller/Symphony.cs | 27 ++++++++++++++++++++- installer/win/install_instructions_win.md | 24 ++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/installer/win/WixSharpInstaller/Symphony.cs b/installer/win/WixSharpInstaller/Symphony.cs index 9f78197f..a6f02a9b 100644 --- a/installer/win/WixSharpInstaller/Symphony.cs +++ b/installer/win/WixSharpInstaller/Symphony.cs @@ -166,6 +166,7 @@ class Script new PublicProperty("DEV_TOOLS_ENABLED", "true"), new PublicProperty("FULL_SCREEN", "true"), new PublicProperty("LOCATION", "true"), + new PublicProperty("LAUNCH_ON_INSTALL", "true"), new PublicProperty("MEDIA", "true"), new PublicProperty("MIDI_SYSEX", "true"), new PublicProperty("MINIMIZE_ON_CLOSE", "ENABLED"), @@ -220,7 +221,10 @@ class Script new ManagedAction(CustomActions.CleanRegistryCurrentUser, Return.ignore, When.After, Step.RemoveFiles, Condition.BeingUninstalled ), // Start Symphony after installation is complete - new InstalledFileAction(new Id("symphony_exe"), "", Return.asyncNoWait, When.After, Step.InstallFinalize, Condition.NOT_BeingRemoved) + new ManagedAction(CustomActions.StartAfterInstall, Return.ignore, When.After, Step.InstallFinalize, Condition.NOT_BeingRemoved ) + { + UsesProperties = "INSTALLDIR,LAUNCH_ON_INSTALL" + }, }; // Use our own Symphony branded bitmap for installation dialogs @@ -470,4 +474,25 @@ public class CustomActions } return ActionResult.Success; } + + // StartAfterInstall custom action + [CustomAction] + public static ActionResult StartAfterInstall(Session session) + { + try + { + if (session.Property("LAUNCH_ON_INSTALL")=="true") + { + System.Diagnostics.Process process = new System.Diagnostics.Process(); + process.StartInfo.FileName = System.IO.Path.Combine(session.Property("INSTALLDIR"), "Symphony.exe"); + process.Start(); + } + } + catch (System.Exception e) + { + session.Log("Error executing StartAfterInstall: " + e.ToString() ); + return ActionResult.Failure; + } + return ActionResult.Success; + } } diff --git a/installer/win/install_instructions_win.md b/installer/win/install_instructions_win.md index cf6e2f12..73a562c4 100644 --- a/installer/win/install_instructions_win.md +++ b/installer/win/install_instructions_win.md @@ -209,6 +209,30 @@ or +------------------------------------------------------------------- +### LAUNCH_ON_INSTALL + +Expected values: + +* "true" + Symphony will be launched automatically after installation has completed (default) +* "false" + Symphony will not be launched after installation has completed + +#### Example, install with launch on install enabled + + msiexec /i Symphony.msi LAUNCH_ON_INSTALL="true" + +or + + msiexec /i Symphony.msi /q + +#### Example, install with launch on install disabled + + msiexec /i Symphony.msi LAUNCH_ON_INSTALL="false" + + + ------------------------------------------------------------------- ### LOCATION