mirror of
https://github.com/velopack/velopack.git
synced 2025-10-25 15:19:22 +00:00
Fix MSI start-menu shortcuts
This commit is contained in:
@@ -90,9 +90,6 @@ public class WindowsPackCommandRunner : PackageBuilder<WindowsPackOptions>
|
||||
|
||||
protected string GetShortcutLocations()
|
||||
{
|
||||
if (String.IsNullOrWhiteSpace(Options.Shortcuts))
|
||||
return "None";
|
||||
|
||||
var flags = GetShortcuts();
|
||||
var names = Enum.GetValues(typeof(ShortcutLocation))
|
||||
.Cast<ShortcutLocation>()
|
||||
@@ -100,7 +97,9 @@ public class WindowsPackCommandRunner : PackageBuilder<WindowsPackOptions>
|
||||
.Select(f => f.ToString())
|
||||
.ToList();
|
||||
|
||||
return names.Count > 0 ? string.Join(",", names) : "None";
|
||||
var shortcutStr = names.Count > 0 ? string.Join(",", names) : "None";
|
||||
Log.Info($"Shortcuts: {shortcutStr}");
|
||||
return shortcutStr;
|
||||
}
|
||||
|
||||
protected string GetRuntimeDependencies()
|
||||
|
||||
@@ -68,6 +68,7 @@ public static class MsiBuilder
|
||||
StubFileName = (options.PackTitle ?? options.PackId) + ".exe",
|
||||
DesktopShortcut = shortcuts.HasFlag(ShortcutLocation.Desktop),
|
||||
StartMenuShortcut = shortcuts.HasFlag(ShortcutLocation.StartMenu),
|
||||
StartMenuRootShortcut = shortcuts.HasFlag(ShortcutLocation.StartMenuRoot),
|
||||
RustNativeModulePath = HelperFile.GetWixNativeModulePath(options.TargetRuntime),
|
||||
SideBannerImagePath = options.MsiBanner ?? HelperFile.WixAssetsDialogBackground,
|
||||
TopBannerImagePath = options.MsiLogo ?? HelperFile.WixAssetsTopBanner,
|
||||
|
||||
@@ -24,9 +24,13 @@ public class MsiTemplateData
|
||||
public string AppVersion;
|
||||
|
||||
public string StubFileName;
|
||||
public string RuntimeDependencies;
|
||||
public bool DesktopShortcut;
|
||||
public bool StartMenuShortcut;
|
||||
public bool StartMenuRootShortcut;
|
||||
|
||||
public string RuntimeDependencies;
|
||||
public bool HasRuntimeDependencies => !string.IsNullOrWhiteSpace(RuntimeDependencies);
|
||||
|
||||
|
||||
public bool InstallLocationEither => InstallForAllUsers && InstallForCurrentUser;
|
||||
public bool InstallLocationAllUsersOnly => InstallForAllUsers && !InstallForCurrentUser;
|
||||
|
||||
@@ -29,15 +29,40 @@
|
||||
{{/if}}
|
||||
|
||||
{{#if StartMenuShortcut}}
|
||||
<StandardDirectory Id="StartMenuFolder">
|
||||
<!-- Shortcut is placed in Start > Programs > AppPublisher -->
|
||||
<Directory Id="ProgramMenuFolder">
|
||||
<Directory Id="AppPublisherProgramMenuDir" Name="{{AppPublisherSanitized}}"/>
|
||||
</Directory>
|
||||
<DirectoryRef Id="AppPublisherProgramMenuDir">
|
||||
<Component Id="ApplicationStartMenuShortcut">
|
||||
<Shortcut Id="ApplicationStartMenuShortcut" Name="{{AppTitle}}" Description="Start Menu shortcut for {{AppTitle}}"
|
||||
Target="[INSTALLFOLDER]{{StubFileName}}" WorkingDirectory="INSTALLFOLDER"/>
|
||||
<RemoveFolder Id="CleanUpStartMenuShortcut" Directory="INSTALLFOLDER" On="uninstall"/>
|
||||
<RegistryValue Root="HKCU" Key="Software\{{AppPublisherSanitized}}\{{AppId}}.StartMenuShortcut"
|
||||
<Shortcut
|
||||
Id="ApplicationStartMenuShortcut"
|
||||
Name="{{AppTitle}}"
|
||||
Description="Start Menu shortcut for {{AppTitle}}"
|
||||
Target="[INSTALLFOLDER]{{StubFileName}}"
|
||||
WorkingDirectory="INSTALLFOLDER"/>
|
||||
<RemoveFolder Id="CleanUpStartMenuShortcut" Directory="AppPublisherProgramMenuDir" On="uninstall"/>
|
||||
<RegistryValue Root="HKMU" Key="Software\{{AppPublisherSanitized}}\{{AppId}}.StartMenuShortcut"
|
||||
Name="installed" Type="integer" Value="1" KeyPath="yes"/>
|
||||
</Component>
|
||||
</DirectoryRef>
|
||||
{{/if}}
|
||||
|
||||
{{#if StartMenuRootShortcut}}
|
||||
<!-- Shortcut is placed directly in Start > Programs -->
|
||||
<StandardDirectory Id="ProgramMenuFolder">
|
||||
<Component Id="ApplicationStartMenuRootShortcut">
|
||||
<Shortcut
|
||||
Id="ApplicationStartMenuRootShortcut"
|
||||
Name="{{AppTitle}}"
|
||||
Description="Start Menu shortcut for {{AppTitle}}"
|
||||
Target="[INSTALLFOLDER]{{StubFileName}}"
|
||||
WorkingDirectory="INSTALLFOLDER"/>
|
||||
<RegistryValue Root="HKMU" Key="Software\{{AppPublisherSanitized}}\{{AppId}}.StartMenuRootShortcut"
|
||||
Name="installed" Type="integer" Value="1" KeyPath="yes"/>
|
||||
</Component>
|
||||
</StandardDirectory>
|
||||
|
||||
{{/if}}
|
||||
|
||||
{{#if HasIcon}}
|
||||
@@ -90,7 +115,9 @@
|
||||
<Property Id="RustAppId" Value="{{AppTitle}}"/>
|
||||
<Property Id="RustAppTitle" Value="{{AppTitle}}"/>
|
||||
<Property Id="RustAppVersion" Value="{{AppVersion}}"/>
|
||||
{{#if HasRuntimeDependencies}}
|
||||
<Property Id="RustRuntimeDependencies" Value="{{RuntimeDependencies}}"/>
|
||||
{{/if}}
|
||||
<Property Id="RustStubFileName" Value="{{StubFileName}}"/>
|
||||
|
||||
<CustomAction Id="RustEarlyBootstrap" BinaryRef="RustDll" DllEntry="EarlyBootstrap" Execute="immediate" Return="check"/>
|
||||
@@ -104,7 +131,7 @@
|
||||
Return="ignore"/>
|
||||
|
||||
<InstallUISequence>
|
||||
<Custom Action="RustEarlyBootstrap" Before="AppSearch" Condition="NOT REMOVE AND NOT RustRuntimeDependencies"/>
|
||||
<Custom Action="RustEarlyBootstrap" Before="AppSearch" Condition="NOT REMOVE AND RustRuntimeDependencies"/>
|
||||
</InstallUISequence>
|
||||
|
||||
<InstallExecuteSequence>
|
||||
|
||||
Reference in New Issue
Block a user