wix-template.xml 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <?include "cpack_variables.wxi"?>
  3. <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
  4. xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
  5. RequiredVersion="3.6.3303.0">
  6. <Product Id="$(var.CPACK_WIX_PRODUCT_GUID)"
  7. Name="$(var.CPACK_PACKAGE_NAME)"
  8. Language="1033"
  9. Version="$(var.CPACK_PACKAGE_VERSION)"
  10. Manufacturer="$(var.CPACK_PACKAGE_VENDOR)"
  11. UpgradeCode="$(var.CPACK_WIX_UPGRADE_GUID)">
  12. <Package InstallScope="perMachine" InstallerVersion="301" Compressed="yes"/>
  13. <Media Id="1" Cabinet="media1.cab" EmbedCab="yes"/>
  14. <MajorUpgrade
  15. Schedule="afterInstallInitialize"
  16. AllowSameVersionUpgrades="yes"
  17. DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit."/>
  18. <WixVariable Id="WixUILicenseRtf" Value="$(var.CPACK_WIX_LICENSE_RTF)"/>
  19. <Property Id="WIXUI_INSTALLDIR" Value="INSTALL_ROOT"/>
  20. <?ifdef CPACK_WIX_PRODUCT_ICON?>
  21. <Property Id="ARPPRODUCTICON">ProductIcon.ico</Property>
  22. <Icon Id="ProductIcon.ico" SourceFile="$(var.CPACK_WIX_PRODUCT_ICON)"/>
  23. <?endif?>
  24. <?ifdef CPACK_WIX_UI_BANNER?>
  25. <WixVariable Id="WixUIBannerBmp" Value="$(var.CPACK_WIX_UI_BANNER)"/>
  26. <?endif?>
  27. <?ifdef CPACK_WIX_UI_DIALOG?>
  28. <WixVariable Id="WixUIDialogBmp" Value="$(var.CPACK_WIX_UI_DIALOG)"/>
  29. <?endif?>
  30. <UI>
  31. <UIRef Id="$(var.CPACK_WIX_UI_REF)" />
  32. <Publish Dialog="KPXC_ExitDialog" Control="Finish" Order="1" Event="DoAction" Value="LaunchApplication">LAUNCHAPPONEXIT</Publish>
  33. </UI>
  34. <?include "properties.wxi"?>
  35. <?include "product_fragment.wxi"?>
  36. <!-- Autostart via registry (optional) -->
  37. <Component Id="Autostart" Guid="*" Directory="INSTALL_ROOT">
  38. <RegistryValue Id="Autostart.rst" Root="HKCU" Action="write"
  39. Key="Software\Microsoft\Windows\CurrentVersion\Run"
  40. Name="$(var.CPACK_PACKAGE_NAME)"
  41. Value="&quot;[#CM_FP_KeePassXC.exe]&quot;"
  42. Type="string" />
  43. <Condition>AUTOSTARTPROGRAM</Condition>
  44. </Component>
  45. <DirectoryRef Id="TARGETDIR">
  46. <!-- Startmenu shortcuts -->
  47. <Directory Id="ProgramMenuFolder">
  48. <Directory Id="ApplicationProgramsFolder" Name="KeePassXC">
  49. <Component Id="ApplicationShortcuts" Guid="*">
  50. <Shortcut Id="ApplicationStartMenuShortcut"
  51. Name="KeePassXC"
  52. Target="[#CM_FP_KeePassXC.exe]"
  53. WorkingDirectory="INSTALL_ROOT"/>
  54. <Shortcut Id="GettingStartedShortcut"
  55. Name="KeePassXC - Getting Started"
  56. Target="[#CM_FP_share.docs.KeePassXC_GettingStarted.html]"
  57. WorkingDirectory="INSTALL_ROOT" />
  58. <Shortcut Id="UserGuideShortcut"
  59. Name="KeePassXC - User Guide"
  60. Target="[#CM_FP_share.docs.KeePassXC_UserGuide.html]"
  61. WorkingDirectory="INSTALL_ROOT" />
  62. <RemoveFolder Id="ApplicationProgramsFolder" On="uninstall" />
  63. <RegistryValue Root="HKCU" Key="Software\KeePassXC" Name="StartMenuShortcut" Type="integer" Value="1" KeyPath="yes"/>
  64. </Component>
  65. </Directory>
  66. </Directory>
  67. <!-- Desktop shortcut (optional) -->
  68. <Directory Id="DesktopFolder" Name="Desktop">
  69. <Component Id="DesktopShortcut" Guid="F8AFBA1C-296C-41AA-B968-60323A206665">
  70. <Condition>INSTALLDESKTOPSHORTCUT</Condition>
  71. <Shortcut Id="ApplicationDesktopShortcut"
  72. Directory="DesktopFolder"
  73. Name="KeePassXC"
  74. Target="[#CM_FP_KeePassXC.exe]"
  75. WorkingDirectory="INSTALL_ROOT" />
  76. <RemoveFile Id="RemoveDesktopIcon" Name="KeePassXC.lnk" On="uninstall" />
  77. <RegistryValue Root="HKCU" Key="Software\KeePassXC" Name="DesktopShortcut" Type="integer" Value="1" KeyPath="yes"/>
  78. </Component>
  79. </Directory>
  80. <!-- Windows system folder -->
  81. <Directory Id="SystemFolder" Name="SystemFolder" />
  82. </DirectoryRef>
  83. <!-- Custom properties to control installation options -->
  84. <Property Id="LAUNCHAPPONEXIT" Value="1" Secure="yes" />
  85. <Property Id="AUTOSTARTPROGRAM" Value="1" Secure="yes" />
  86. <Property Id="AUTOSTARTPROGRAM_REGISTRY">
  87. <RegistrySearch Id="AutoStartSearch" Root="HKCU" Key="Software\Microsoft\Windows\CurrentVersion\Run" Name="$(var.CPACK_PACKAGE_NAME)" Type="raw" />
  88. </Property>
  89. <Property Id="INSTALLDESKTOPSHORTCUT" Secure="yes" />
  90. <!-- Set properties based on existing conditions, prevents changing state on upgrade -->
  91. <SetProperty Id="AUTOSTARTPROGRAM" After="AppSearch" Value="">AUTOSTARTPROGRAM="0" OR (WIX_UPGRADE_DETECTED AND NOT AUTOSTARTPROGRAM_REGISTRY)</SetProperty>
  92. <SetProperty Id="LicenseAccepted" After="AppSearch" Value="1">WIX_UPGRADE_DETECTED</SetProperty>
  93. <FeatureRef Id="ProductFeature">
  94. <ComponentRef Id="ApplicationShortcuts" />
  95. <ComponentRef Id="Autostart" />
  96. <ComponentRef Id="DesktopShortcut" />
  97. </FeatureRef>
  98. <!-- Action to launch application after installer exits -->
  99. <Property Id="WixShellExecTarget" Value="[#CM_FP_KeePassXC.exe]" />
  100. <CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />
  101. <!-- Action to kill running KeePassXC process -->
  102. <Property Id="WixQuietExecCmdLine" Value='"[SystemFolder]taskkill.exe" /IM KeePassXC.exe' />
  103. <CustomAction Id="KillKeePassXC" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="immediate" Return="ignore" />
  104. <!-- Action to kill running keepassxc-proxy processes -->
  105. <Property Id="WixSilentExecCmdLine" Value='"[SystemFolder]taskkill.exe" /IM keepassxc-proxy.exe /F' />
  106. <CustomAction Id="KillKeePassXCProxy" BinaryKey="WixCA" DllEntry="WixSilentExec" Execute="immediate" Return="ignore" />
  107. <InstallExecuteSequence>
  108. <Custom Action="KillKeePassXC" Before="InstallValidate" />
  109. <Custom Action="KillKeePassXCProxy" Before="InstallValidate" />
  110. <!-- Prevent pinned taskbar shortcut from being removed -->
  111. <RemoveShortcuts Suppress="yes" />
  112. </InstallExecuteSequence>
  113. </Product>
  114. </Wix>