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

enhance(bundler/wix): generate consistent product code for MSI installer derived from identifier (#10969)

* enhance(bundler/wix): generate consistent product code for MSI installer derived from identifier

* Update .changes/wix-consistent-product-code.md [skip ci]

* Update .changes/wix-consistent-product-code.md [skip ci]

---------

Co-authored-by: Lucas Fernandes Nogueira <lucas@tauri.app>
Amr Bashir 10 сар өмнө
parent
commit
a1e88d2b57

+ 6 - 0
.changes/wix-consistent-product-code.md

@@ -0,0 +1,6 @@
+---
+"tauri-bundler": "patch:enhance"
+---
+
+Generate a consistent Product code for MSI installer derived from `identifier` instead of generating random one each build.
+

+ 6 - 0
crates/tauri-bundler/src/bundle/windows/msi/wix.rs

@@ -529,6 +529,12 @@ pub fn build_wix_app_installer(
   .to_string();
 
   data.insert("upgrade_code", to_json(upgrade_code.as_str()));
+  let product_code = Uuid::new_v5(
+    &Uuid::NAMESPACE_DNS,
+    &settings.bundle_identifier().as_bytes(),
+  )
+  .to_string();
+  data.insert("product_code", to_json(product_code.as_str()));
   data.insert(
     "allow_downgrades",
     to_json(settings.windows().allow_downgrades),

+ 1 - 1
crates/tauri-bundler/src/bundle/windows/templates/main.wxs

@@ -13,7 +13,7 @@
 
 <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
     <Product
-            Id="*"
+            Id="{{product_code}}"
             Name="{{product_name}}"
             UpgradeCode="{{upgrade_code}}"
             Language="!(loc.TauriLanguage)"