diff --git a/src/Update/Program.cs b/src/Update/Program.cs index e1330bc57..ff4ea953a 100644 --- a/src/Update/Program.cs +++ b/src/Update/Program.cs @@ -122,7 +122,7 @@ int executeCommandLine(string[] args) UpdateSelf().Wait(); break; case UpdateAction.Shortcut: - Shortcut(opt.target, opt.shortcutArgs, opt.processStartArgs, opt.setupIcon); + Shortcut(opt.target, opt.shortcutArgs, opt.processStartArgs, opt.setupIcon, opt.onlyUpdateShortcuts); break; case UpdateAction.Deshortcut: Deshortcut(opt.target, opt.shortcutArgs); @@ -422,7 +422,7 @@ public void Releasify(string package, string targetDir = null, string packagesDi } } - public void Shortcut(string exeName, string shortcutArgs, string processStartArgs, string icon) + public void Shortcut(string exeName, string shortcutArgs, string processStartArgs, string icon, bool onlyUpdate) { if (String.IsNullOrWhiteSpace(exeName)) { ShowHelp(); @@ -434,7 +434,7 @@ public void Shortcut(string exeName, string shortcutArgs, string processStartArg var locations = parseShortcutLocations(shortcutArgs); using (var mgr = new UpdateManager("", appName)) { - mgr.CreateShortcutsForExecutable(exeName, locations ?? defaultLocations, false, processStartArgs, icon); + mgr.CreateShortcutsForExecutable(exeName, locations ?? defaultLocations, onlyUpdate, processStartArgs, icon); } } diff --git a/src/Update/StartupOption.cs b/src/Update/StartupOption.cs index 379c1ac17..2be5641b5 100644 --- a/src/Update/StartupOption.cs +++ b/src/Update/StartupOption.cs @@ -26,6 +26,7 @@ internal class StartupOption internal bool noMsi { get; private set; } = (Environment.OSVersion.Platform != PlatformID.Win32NT); // NB: WiX doesn't work under Mono / Wine internal bool packageAs64Bit { get; private set; } = false; internal bool noDelta { get; private set; } = false; + internal bool onlyUpdateShortcuts { get; private set; } = false; public StartupOption(string[] args) { optionSet = Parse(args); @@ -66,6 +67,7 @@ private OptionSet Parse(string[] args) { { "no-delta", "Don't generate delta packages to save time", v => noDelta = true}, { "framework-version=", "Set the required .NET framework version, e.g. net461", v => frameworkVersion = v }, { "msi-win64", "Mark the MSI as 64-bit, which is useful in Enterprise deployment scenarios", _ => packageAs64Bit = true}, + { "updateOnly", "Update shortcuts that already exist, rather than creating new ones", _ => onlyUpdateShortcuts = true}, }; opts.Parse(args);