Files
velopack/src/vpk/Velopack.Packaging.Windows/Msi/Templates/MsiTemplate.hbs
2025-05-27 21:03:04 +01:00

280 lines
15 KiB
Handlebars

<!--suppress CheckEmptyScriptTag -->
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui">
<Package Name="{{AppTitle}}"
Manufacturer="{{AppPublisher}}"
Version="{{AppMsiVersion}}"
Language="1033"
Scope="perUserOrMachine"
UpgradeCode="{{UpgradeCodeGuid}}">
<Media Id="1" Cabinet="app.cab" EmbedCab="yes"/>
<StandardDirectory Id="TARGETDIR">
<Directory Id="INSTALLFOLDER" Name="{{AppTitleSanitized}}" ComponentGuidGenerationSeed="{{ComponentGenerationSeedGuid}}">
<Directory Name="current"/>
<Directory Id="PACKAGES_DIR" Name="packages"/>
</Directory>
</StandardDirectory>
{{#if DesktopShortcut}}
<StandardDirectory Id="DesktopFolder">
<Component Id="ApplicationDesktopShortcut">
<Shortcut Id="ApplicationDesktopShortcut" Name="{{AppTitle}}" Description="Desktop shortcut for {{AppTitle}}"
Target="[INSTALLFOLDER]{{StubFileName}}" WorkingDirectory="INSTALLFOLDER"/>
<RemoveFolder Id="CleanUpDesktopShortcut" Directory="INSTALLFOLDER" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software&#92;{{AppPublisherSanitized}}&#92;{{AppId}}.DesktopShortcut"
Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</StandardDirectory>
{{/if}}
{{#if StartMenuShortcut}}
<!-- 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="AppPublisherProgramMenuDir" On="uninstall"/>
<RegistryValue Root="HKMU" Key="Software&#92;{{AppPublisherSanitized}}&#92;{{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&#92;{{AppPublisherSanitized}}&#92;{{AppId}}.StartMenuRootShortcut"
Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</StandardDirectory>
{{/if}}
{{#if HasIcon}}
<Icon Id="appicon" SourceFile="{{IconPath}}"/>
<Property Id="ARPPRODUCTICON" Value="appicon"/>
{{/if}}
{{#if HasLicense}}
<WixVariable Id="WixUILicenseRtf" Value="{{LicenseRtfFilePath}}"/>
{{/if}}
{{#if HasTopBannerImage}}
<WixVariable Id="WixUIBannerBmp" Value="{{TopBannerImagePath}}"/>
{{/if}}
{{#if HasSideBannerImage}}
<WixVariable Id="WixUIDialogBmp" Value="{{SideBannerImagePath}}"/>
{{/if}}
<!-- Message on last screen after install -->
{{#if HasConclusionMessage}}
<Property Id="WIXUI_EXITDIALOGOPTIONALTEXT" Value="{{ConclusionMessage}}"/>
{{/if}}
<!-- Default checked state of launch app check box to true -->
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="1"/>
<!-- Check box for launching -->
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="!(loc.ConclusionLaunchCheckboxText) {{AppTitle}}"/>
<Property Id="WixAppFolder" Value="WixPerMachineFolder"/>
<Property Id="ApplicationFolderName" Value="{{AppId}}"/>
{{#if InstallLocationEither}}
<WixVariable Id="override WixUISupportPerUser" Value="1"/>
<WixVariable Id="override WixUISupportPerMachine" Value="1"/>
{{/if}}
<UI>
<ui:WixUI Id="WixUI_Velopack" InstallDirectory="INSTALLFOLDER"/>
<Publish Dialog="ExitDialog" Control="Finish" Event="DoAction" Value="RustLaunchApplication"
Condition="WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed"/>
</UI>
<Files Include="{{SourceDirectoryPath}}\**"/>
<!-- Add our custom Rust module for custom actions -->
<Binary Id="RustDll" SourceFile="{{RustNativeModulePath}}"/>
<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"/>
<!-- deferred actions do not have access to msi properties and read all data from "CustomActionData" which is a string,
so we delimit with &quot; which is unlikely (or disallowed) from to appearing in filenames / paths.-->
<CustomAction Id="SetRustCleanupData" Property="RustCleanup" Value="[INSTALLFOLDER]&quot;[RustAppId]&quot;[TempFolder]" Execute="immediate"
Return="check"/>
<CustomAction Id="RustCleanup" BinaryRef="RustDll" DllEntry="CleanupDeferred" Execute="deferred" Impersonate="no" Return="ignore"/>
<CustomAction Id="RustLaunchApplication" BinaryRef="RustDll" DllEntry="LaunchApplication" Impersonate="yes" Execute="immediate"
Return="ignore"/>
<InstallUISequence>
<Custom Action="RustEarlyBootstrap" Before="AppSearch" Condition="NOT REMOVE AND RustRuntimeDependencies"/>
</InstallUISequence>
<InstallExecuteSequence>
<Custom Action="SetRustCleanupData" Before="RustCleanup" Condition="(REMOVE=&quot;ALL&quot;)"/>
<Custom Action="RustCleanup" Before="RemoveFolders" Condition="(REMOVE=&quot;ALL&quot;)"/>
</InstallExecuteSequence>
</Package>
<!-- https://github.com/wixtoolset/wix/blob/v5.0.2/src/ext/UI/wixlib/WixUI_Advanced.wxs -->
<?foreach WIXUIARCH in X86;X64;A64 ?>
<Fragment>
<UI Id="WixUI_Velopack_$(WIXUIARCH)">
{{#if HasLicense}}
<Publish Dialog="LicenseAgreementDlg" Control="Print" Event="DoAction"
Value="WixUIPrintEula_$(WIXUIARCH)"/>
{{/if}}
<Publish Dialog="BrowseDlg" Control="OK" Event="DoAction" Value="WixUIValidatePath_$(WIXUIARCH)" Order="3"
Condition="NOT WIXUI_DONTVALIDATEPATH"/>
{{#if InstallLocationEither}}
<Publish Dialog="InstallScopeDlg" Control="Next" Event="DoAction" Value="WixUIValidatePath_$(WIXUIARCH)"
Order="7" Condition="NOT WIXUI_DONTVALIDATEPATH"/>
{{/if}}
</UI>
<UIRef Id="WixUI_Velopack"/>
</Fragment>
<?endforeach?>
<Fragment>
<PropertyRef Id="ApplicationFolderName"/>
<UI Id="file WixUI_Velopack">
<TextStyle Id="WixUI_Font_Normal" FaceName="Segoe UI" Size="8"/>
<TextStyle Id="WixUI_Font_Bigger" FaceName="Segoe UI" Size="12"/>
<TextStyle Id="WixUI_Font_Title" FaceName="Segoe UI" Size="9" Bold="yes"/>
<Property Id="DefaultUIFont" Value="WixUI_Font_Normal"/>
<DialogRef Id="BrowseDlg"/>
<DialogRef Id="DiskCostDlg"/>
<DialogRef Id="ErrorDlg"/>
<DialogRef Id="FatalError"/>
<DialogRef Id="FilesInUse"/>
<DialogRef Id="MsiRMFilesInUse"/>
<DialogRef Id="PrepareDlg"/>
<DialogRef Id="ProgressDlg"/>
<DialogRef Id="ResumeDlg"/>
<DialogRef Id="UserExit"/>
<Publish Dialog="BrowseDlg" Control="OK" Event="SpawnDialog" Value="InvalidDirDlg" Order="4"
Condition="NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID&lt;&gt;1"/>
<Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999"/>
{{#if HasLicense}}
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="LicenseAgreementDlg" Condition="NOT Installed"/>
{{else}}
{{#if InstallLocationEither}}
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="InstallScopeDlg" Condition="NOT Installed"/>
{{else}}
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Condition="NOT Installed"/>
{{/if}}
{{/if}}
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Condition="Installed AND PATCH"/>
{{#if HasLicense}}
<Publish Dialog="LicenseAgreementDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg"/>
{{#if InstallLocationEither}}
<Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="InstallScopeDlg"
Condition="LicenseAccepted = &quot;1&quot;"/>
{{else}}
<Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg"
Condition="LicenseAccepted = &quot;1&quot;"/>
{{/if}}
{{/if}}
{{#if InstallLocationEither}}
{{#if HasLicense}}
<Publish Dialog="InstallScopeDlg" Control="Back" Event="NewDialog" Value="LicenseAgreementDlg"/>
{{else}}
<Publish Dialog="InstallScopeDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg"/>
{{/if}}
<Publish Dialog="InstallScopeDlg" Control="Next" Property="WixAppFolder" Value="WixPerUserFolder"
Order="1" Condition="!(wix.WixUISupportPerUser) AND NOT Privileged"/>
<Publish Dialog="InstallScopeDlg" Control="Next" Property="ALLUSERS" Value="{}" Order="2"
Condition="WixAppFolder = &quot;WixPerUserFolder&quot;"/>
<Publish Dialog="InstallScopeDlg" Control="Next" Property="ALLUSERS" Value="1" Order="3"
Condition="WixAppFolder = &quot;WixPerMachineFolder&quot;"/>
<Publish Dialog="InstallScopeDlg" Control="Next" Property="INSTALLFOLDER"
Value="[LocalAppDataFolder][ApplicationFolderName]" Order="4"
Condition="WixAppFolder = &quot;WixPerUserFolder&quot;"/>
<Publish Dialog="InstallScopeDlg" Control="Next" Property="INSTALLFOLDER"
Value="{{ProgramFilesFolderName}}[ApplicationFolderName]" Order="5"
Condition="WixAppFolder = &quot;WixPerMachineFolder&quot;"/>
<Publish Dialog="InstallScopeDlg" Control="Next" Event="SetTargetPath" Value="INSTALLFOLDER" Order="6"/>
<Publish Dialog="InstallScopeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="7"/>
<Publish Dialog="InstallScopeDlg" Control="Next" Event="DoAction" Value="FindRelatedProducts" Order="8"/>
{{/if}}
{{#if InstallLocationCurrentUserOnly}}
<Publish Dialog="WelcomeDlg" Control="Next" Property="ALLUSERS" Value="{}" Order="1"
Condition="WixAppFolder = &quot;WixPerUserFolder&quot;"/>
<Publish Dialog="WelcomeDlg" Control="Next" Property="INSTALLFOLDER"
Value="[LocalAppDataFolder][ApplicationFolderName]" Order=" 2"/>
<Publish Dialog="WelcomeDlg" Control="Next" Event="SetTargetPath" Value="INSTALLFOLDER" Order="3"/>
{{/if}}
{{#if InstallLocationAllUsersOnly}}
<Publish Dialog="WelcomeDlg" Control="Next" Property="ALLUSERS" Value="1" Order="1"
Condition="WixAppFolder = &quot;WixPerMachineFolder&quot;"/>
<Publish Dialog="WelcomeDlg" Control="Next" Property="INSTALLFOLDER"
Value="{{ProgramFilesFolderName}}[ApplicationFolderName]" Order="5"
Condition="WixAppFolder = &quot;WixPerMachineFolder&quot;"/>
<Publish Dialog="WelcomeDlg" Control="Next" Event="SetTargetPath" Value="INSTALLFOLDER" Order="3"/>
{{/if}}
{{#if InstallLocationEither}}
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="InstallScopeDlg" Order="1"
Condition="NOT Installed"/>
{{else}}
{{#if HasLicense}}
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="LicenseAgreementDlg" Order="1"
Condition="NOT Installed"/>
{{else}}
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="1"
Condition="NOT Installed"/>
{{/if}}
{{/if}}
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2"
Condition="Installed AND NOT PATCH"/>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2"
Condition="Installed AND PATCH"/>
<Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg"/>
<Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="VerifyReadyDlg"/>
<Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg"/>
<Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg"/>
<Property Id="ARPNOMODIFY" Value="1"/>
</UI>
<UIRef Id="WixUI_Common"/>
</Fragment>
</Wix>