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()
|
protected string GetShortcutLocations()
|
||||||
{
|
{
|
||||||
if (String.IsNullOrWhiteSpace(Options.Shortcuts))
|
|
||||||
return "None";
|
|
||||||
|
|
||||||
var flags = GetShortcuts();
|
var flags = GetShortcuts();
|
||||||
var names = Enum.GetValues(typeof(ShortcutLocation))
|
var names = Enum.GetValues(typeof(ShortcutLocation))
|
||||||
.Cast<ShortcutLocation>()
|
.Cast<ShortcutLocation>()
|
||||||
@@ -100,7 +97,9 @@ public class WindowsPackCommandRunner : PackageBuilder<WindowsPackOptions>
|
|||||||
.Select(f => f.ToString())
|
.Select(f => f.ToString())
|
||||||
.ToList();
|
.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()
|
protected string GetRuntimeDependencies()
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ public static class MsiBuilder
|
|||||||
StubFileName = (options.PackTitle ?? options.PackId) + ".exe",
|
StubFileName = (options.PackTitle ?? options.PackId) + ".exe",
|
||||||
DesktopShortcut = shortcuts.HasFlag(ShortcutLocation.Desktop),
|
DesktopShortcut = shortcuts.HasFlag(ShortcutLocation.Desktop),
|
||||||
StartMenuShortcut = shortcuts.HasFlag(ShortcutLocation.StartMenu),
|
StartMenuShortcut = shortcuts.HasFlag(ShortcutLocation.StartMenu),
|
||||||
|
StartMenuRootShortcut = shortcuts.HasFlag(ShortcutLocation.StartMenuRoot),
|
||||||
RustNativeModulePath = HelperFile.GetWixNativeModulePath(options.TargetRuntime),
|
RustNativeModulePath = HelperFile.GetWixNativeModulePath(options.TargetRuntime),
|
||||||
SideBannerImagePath = options.MsiBanner ?? HelperFile.WixAssetsDialogBackground,
|
SideBannerImagePath = options.MsiBanner ?? HelperFile.WixAssetsDialogBackground,
|
||||||
TopBannerImagePath = options.MsiLogo ?? HelperFile.WixAssetsTopBanner,
|
TopBannerImagePath = options.MsiLogo ?? HelperFile.WixAssetsTopBanner,
|
||||||
|
|||||||
@@ -24,10 +24,14 @@ public class MsiTemplateData
|
|||||||
public string AppVersion;
|
public string AppVersion;
|
||||||
|
|
||||||
public string StubFileName;
|
public string StubFileName;
|
||||||
public string RuntimeDependencies;
|
|
||||||
public bool DesktopShortcut;
|
public bool DesktopShortcut;
|
||||||
public bool StartMenuShortcut;
|
public bool StartMenuShortcut;
|
||||||
|
public bool StartMenuRootShortcut;
|
||||||
|
|
||||||
|
public string RuntimeDependencies;
|
||||||
|
public bool HasRuntimeDependencies => !string.IsNullOrWhiteSpace(RuntimeDependencies);
|
||||||
|
|
||||||
|
|
||||||
public bool InstallLocationEither => InstallForAllUsers && InstallForCurrentUser;
|
public bool InstallLocationEither => InstallForAllUsers && InstallForCurrentUser;
|
||||||
public bool InstallLocationAllUsersOnly => InstallForAllUsers && !InstallForCurrentUser;
|
public bool InstallLocationAllUsersOnly => InstallForAllUsers && !InstallForCurrentUser;
|
||||||
public bool InstallLocationCurrentUserOnly => !InstallForAllUsers && InstallForCurrentUser;
|
public bool InstallLocationCurrentUserOnly => !InstallForAllUsers && InstallForCurrentUser;
|
||||||
|
|||||||
@@ -29,15 +29,40 @@
|
|||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if StartMenuShortcut}}
|
{{#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">
|
<Component Id="ApplicationStartMenuShortcut">
|
||||||
<Shortcut Id="ApplicationStartMenuShortcut" Name="{{AppTitle}}" Description="Start Menu shortcut for {{AppTitle}}"
|
<Shortcut
|
||||||
Target="[INSTALLFOLDER]{{StubFileName}}" WorkingDirectory="INSTALLFOLDER"/>
|
Id="ApplicationStartMenuShortcut"
|
||||||
<RemoveFolder Id="CleanUpStartMenuShortcut" Directory="INSTALLFOLDER" On="uninstall"/>
|
Name="{{AppTitle}}"
|
||||||
<RegistryValue Root="HKCU" Key="Software\{{AppPublisherSanitized}}\{{AppId}}.StartMenuShortcut"
|
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"/>
|
Name="installed" Type="integer" Value="1" KeyPath="yes"/>
|
||||||
</Component>
|
</Component>
|
||||||
</StandardDirectory>
|
</StandardDirectory>
|
||||||
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if HasIcon}}
|
{{#if HasIcon}}
|
||||||
@@ -90,7 +115,9 @@
|
|||||||
<Property Id="RustAppId" Value="{{AppTitle}}"/>
|
<Property Id="RustAppId" Value="{{AppTitle}}"/>
|
||||||
<Property Id="RustAppTitle" Value="{{AppTitle}}"/>
|
<Property Id="RustAppTitle" Value="{{AppTitle}}"/>
|
||||||
<Property Id="RustAppVersion" Value="{{AppVersion}}"/>
|
<Property Id="RustAppVersion" Value="{{AppVersion}}"/>
|
||||||
<Property Id="RustRuntimeDependencies" Value="{{RuntimeDependencies}}"/>
|
{{#if HasRuntimeDependencies}}
|
||||||
|
<Property Id="RustRuntimeDependencies" Value="{{RuntimeDependencies}}"/>
|
||||||
|
{{/if}}
|
||||||
<Property Id="RustStubFileName" Value="{{StubFileName}}"/>
|
<Property Id="RustStubFileName" Value="{{StubFileName}}"/>
|
||||||
|
|
||||||
<CustomAction Id="RustEarlyBootstrap" BinaryRef="RustDll" DllEntry="EarlyBootstrap" Execute="immediate" Return="check"/>
|
<CustomAction Id="RustEarlyBootstrap" BinaryRef="RustDll" DllEntry="EarlyBootstrap" Execute="immediate" Return="check"/>
|
||||||
@@ -104,7 +131,7 @@
|
|||||||
Return="ignore"/>
|
Return="ignore"/>
|
||||||
|
|
||||||
<InstallUISequence>
|
<InstallUISequence>
|
||||||
<Custom Action="RustEarlyBootstrap" Before="AppSearch" Condition="NOT REMOVE AND NOT RustRuntimeDependencies"/>
|
<Custom Action="RustEarlyBootstrap" Before="AppSearch" Condition="NOT REMOVE AND RustRuntimeDependencies"/>
|
||||||
</InstallUISequence>
|
</InstallUISequence>
|
||||||
|
|
||||||
<InstallExecuteSequence>
|
<InstallExecuteSequence>
|
||||||
|
|||||||
Reference in New Issue
Block a user