Correct application shortcut created by MSI Installer (#3296)

* Add launch app after install to MSI Installer
* The last page of the MSI installer includes a checkbox to launch KeePassXC after finish
This commit is contained in:
Jonathan White 2019-06-29 18:34:19 -04:00 committed by GitHub
parent 8e248bbde6
commit 12cefdb7d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 17 deletions

View File

@ -1,10 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<CPackWiXPatch> <CPackWiXPatch>
<CPackWiXFragment Id="CM_FP_KeePassXC.exe">
<Shortcut Id="CM_SP_KeePassXC.exe" Directory="ProgramMenuFolder"
Name="KeePassXC" Icon="ProductIcon.ico"
WorkingDirectory="INSTALL_ROOT" Advertise="yes" />
</CPackWiXFragment>
<CPackWiXFragment Id="CM_CP_KeePassXC.exe"> <CPackWiXFragment Id="CM_CP_KeePassXC.exe">
<ProgId Id="KeePassXC.kdbx" Description="KeePass Password Database" Icon="CM_FP_KeePassXC.exe" IconIndex="1"> <ProgId Id="KeePassXC.kdbx" Description="KeePass Password Database" Icon="CM_FP_KeePassXC.exe" IconIndex="1">
<Extension Id="kdbx" ContentType="application/x-keepass2"> <Extension Id="kdbx" ContentType="application/x-keepass2">

View File

@ -37,29 +37,56 @@
<?ifdef CPACK_WIX_UI_DIALOG?> <?ifdef CPACK_WIX_UI_DIALOG?>
<WixVariable Id="WixUIDialogBmp" Value="$(var.CPACK_WIX_UI_DIALOG)"/> <WixVariable Id="WixUIDialogBmp" Value="$(var.CPACK_WIX_UI_DIALOG)"/>
<?endif?> <?endif?>
<FeatureRef Id="ProductFeature">
<ComponentRef Id="ApplicationShortcut" />
</FeatureRef>
<FeatureRef Id="ProductFeature"/> <UI>
<UIRef Id="$(var.CPACK_WIX_UI_REF)" />
<UIRef Id="$(var.CPACK_WIX_UI_REF)" /> <Publish Dialog="ExitDialog"
Control="Finish"
Event="DoAction"
Value="LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
</UI>
<?include "properties.wxi"?> <?include "properties.wxi"?>
<?include "product_fragment.wxi"?> <?include "product_fragment.wxi"?>
<DirectoryRef Id="TARGETDIR"> <DirectoryRef Id="TARGETDIR">
<Directory Id="ProgramMenuFolder" /> <Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="KeePassXC"/>
</Directory>
</DirectoryRef> </DirectoryRef>
<Property Id="WixSilentExecCmdLine" Value='"Taskkill" /IM KeePassXC.exe'/> <DirectoryRef Id="ApplicationProgramsFolder">
<CustomAction Id="KillKeePassXCInstall" BinaryKey="WixCA" DllEntry="WixSilentExec" Execute="immediate" Return="ignore"/> <Component Id="ApplicationShortcut" Guid="*">
<CustomAction Id="KillKeePassXCUninstall" BinaryKey="WixCA" DllEntry="WixSilentExec" Execute="immediate" Return="ignore"/> <Shortcut Id="ApplicationStartMenuShortcut"
Name="KeePassXC"
Target="[#CM_FP_KeePassXC.exe]"
Icon="ProductIcon.ico"
WorkingDirectory="INSTALL_ROOT"/>
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\KeePassXC" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
<Property Id="WixQuietExecCmdLine" Value='"Taskkill" /IM keepassxc-proxy.exe /F'/> <Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="1" />
<CustomAction Id="KillProxyInstall" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="immediate" Return="ignore"/> <Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch $(var.CPACK_PACKAGE_NAME)" />
<CustomAction Id="KillProxyUninstall" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="immediate" Return="ignore"/> <Property Id="WixShellExecTarget" Value="[#CM_FP_KeePassXC.exe]" />
<CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />
<Property Id="WixSilentExecCmdLine" Value='"Taskkill" /IM KeePassXC.exe' />
<CustomAction Id="KillKeePassXCInstall" BinaryKey="WixCA" DllEntry="WixSilentExec" Execute="immediate" Return="ignore" />
<CustomAction Id="KillKeePassXCUninstall" BinaryKey="WixCA" DllEntry="WixSilentExec" Execute="immediate" Return="ignore" />
<Property Id="WixQuietExecCmdLine" Value='"Taskkill" /IM keepassxc-proxy.exe /F' />
<CustomAction Id="KillProxyInstall" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="immediate" Return="ignore" />
<CustomAction Id="KillProxyUninstall" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="immediate" Return="ignore" />
<InstallExecuteSequence> <InstallExecuteSequence>
<Custom Action="KillKeePassXCInstall" After="InstallInitialize"/> <Custom Action="KillKeePassXCInstall" After="InstallInitialize" />
<Custom Action="KillProxyInstall" After="InstallInitialize"/> <Custom Action="KillProxyInstall" After="InstallInitialize" />
<Custom Action="KillKeePassXCUninstall" Before="InstallValidate">Installed</Custom> <Custom Action="KillKeePassXCUninstall" Before="InstallValidate">Installed</Custom>
<Custom Action="KillProxyUninstall" Before="InstallValidate">Installed</Custom> <Custom Action="KillProxyUninstall" Before="InstallValidate">Installed</Custom>
</InstallExecuteSequence> </InstallExecuteSequence>