Эх сурвалжийг харах

feat(bundler): configure WiX to add launch option, closes #3015 (#3043)

Lucas Fernandes Nogueira 3 жил өмнө
parent
commit
feb3a8f896

+ 5 - 0
.changes/wix-run-app.md

@@ -0,0 +1,5 @@
+---
+"tauri-bundler": patch
+---
+
+Configure WiX to add an option to launch the application after finishing setup.

+ 2 - 0
tooling/bundler/src/bundle/windows/msi/wix.rs

@@ -330,6 +330,8 @@ fn run_light(
   let mut args: Vec<String> = vec![
     "-ext".to_string(),
     "WixUIExtension".to_string(),
+    "-ext".to_string(),
+    "WixUtilExtension".to_string(),
     "-o".to_string(),
     output_path.display().to_string(),
   ];

+ 8 - 0
tooling/bundler/src/bundle/windows/templates/main.wxs

@@ -46,7 +46,15 @@
         <Property Id="ARPNOREPAIR" Value="yes" Secure="yes" />      <!-- Remove repair -->
         <SetProperty Id="ARPNOMODIFY" Value="1" After="InstallValidate" Sequence="execute"/>
 
+        <!-- launch app checkbox -->
+        <Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch {{{product_name}}}" />
+        <Property Id="WixShellExecTarget" Value="{{{app_exe_source}}}" />
+        <CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />
+
         <UI>
+            <!-- launch app checkbox -->
+            <Publish Dialog="ExitDialog" Control="Finish" Event="DoAction" Value="LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
+
             <Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
 
             {{#unless license}}