From 2dbe06658589c0932dee4c5d03f533494176700e Mon Sep 17 00:00:00 2001 From: Christian Fasshauer Date: Thu, 27 Nov 2025 18:04:50 +0100 Subject: [PATCH 1/4] feat(bundler): consider extensions defined in main.wxs. --- .../src/bundle/windows/msi/mod.rs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/crates/tauri-bundler/src/bundle/windows/msi/mod.rs b/crates/tauri-bundler/src/bundle/windows/msi/mod.rs index cc5f83883052..632011eca9a6 100644 --- a/crates/tauri-bundler/src/bundle/windows/msi/mod.rs +++ b/crates/tauri-bundler/src/bundle/windows/msi/mod.rs @@ -755,24 +755,26 @@ pub fn build_wix_app_installer( let main_wxs_path = output_path.join("main.wxs"); fs::write(main_wxs_path, handlebars.render("main.wxs", &data)?)?; - let mut candle_inputs = vec![("main.wxs".into(), Vec::new())]; + let mut candle_inputs = vec![]; let current_dir = std::env::current_dir()?; let extension_regex = Regex::new("\"http://schemas.microsoft.com/wix/(\\w+)\"")?; - for fragment_path in fragment_paths { - let fragment_path = current_dir.join(fragment_path); - let fragment_content = fs::read_to_string(&fragment_path)?; - let fragment_handlebars = Handlebars::new(); - let fragment = fragment_handlebars.render_template(&fragment_content, &data)?; + let input_paths = std::iter::once(output_path.join(PathBuf::from("main.wxs"))) + .chain(fragment_paths.iter().map(|p| current_dir.join(p))); + + for input_path in input_paths { + let input_content = fs::read_to_string(&input_path)?; + let input_handlebars = Handlebars::new(); + let input = input_handlebars.render_template(&input_content, &data)?; let mut extensions = Vec::new(); - for cap in extension_regex.captures_iter(&fragment) { + for cap in extension_regex.captures_iter(&input) { let path = wix_toolset_path.join(format!("Wix{}.dll", &cap[1])); if settings.windows().can_sign() { try_sign(&path, settings)?; } extensions.push(path); } - candle_inputs.push((fragment_path, extensions)); + candle_inputs.push((input_path, extensions)); } let mut fragment_extensions = HashSet::new(); From 2855f132098e88855ee04d34d7ec68e9652206de Mon Sep 17 00:00:00 2001 From: Christian Fasshauer Date: Mon, 1 Dec 2025 15:21:16 +0100 Subject: [PATCH 2/4] chore(bundler): apply nitpick and add a change file. --- .changes/support-template-extensions.md | 5 +++++ crates/tauri-bundler/src/bundle/windows/msi/mod.rs | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 .changes/support-template-extensions.md diff --git a/.changes/support-template-extensions.md b/.changes/support-template-extensions.md new file mode 100644 index 000000000000..13507913f5ef --- /dev/null +++ b/.changes/support-template-extensions.md @@ -0,0 +1,5 @@ +--- +tauri-bundler: minor:feat +--- + +Consider extensions that are defined in the wxs template. diff --git a/crates/tauri-bundler/src/bundle/windows/msi/mod.rs b/crates/tauri-bundler/src/bundle/windows/msi/mod.rs index 632011eca9a6..2979cab2ccca 100644 --- a/crates/tauri-bundler/src/bundle/windows/msi/mod.rs +++ b/crates/tauri-bundler/src/bundle/windows/msi/mod.rs @@ -753,14 +753,14 @@ pub fn build_wix_app_installer( } let main_wxs_path = output_path.join("main.wxs"); - fs::write(main_wxs_path, handlebars.render("main.wxs", &data)?)?; + fs::write(main_wxs_path.clone(), handlebars.render("main.wxs", &data)?)?; let mut candle_inputs = vec![]; let current_dir = std::env::current_dir()?; let extension_regex = Regex::new("\"http://schemas.microsoft.com/wix/(\\w+)\"")?; - let input_paths = std::iter::once(output_path.join(PathBuf::from("main.wxs"))) - .chain(fragment_paths.iter().map(|p| current_dir.join(p))); + let input_paths = + std::iter::once(main_wxs_path).chain(fragment_paths.iter().map(|p| current_dir.join(p))); for input_path in input_paths { let input_content = fs::read_to_string(&input_path)?; From ce74c1e22a5851d388d3c36e992e592d01779b99 Mon Sep 17 00:00:00 2001 From: chfaft <129761080+chfaft@users.noreply.github.com> Date: Mon, 1 Dec 2025 18:20:24 +0100 Subject: [PATCH 3/4] Update crates/tauri-bundler/src/bundle/windows/msi/mod.rs chore(bundler): avoid clone and use reference. Co-authored-by: Tony <68118705+Legend-Master@users.noreply.github.com> --- crates/tauri-bundler/src/bundle/windows/msi/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/tauri-bundler/src/bundle/windows/msi/mod.rs b/crates/tauri-bundler/src/bundle/windows/msi/mod.rs index 2979cab2ccca..4c00d8f333c0 100644 --- a/crates/tauri-bundler/src/bundle/windows/msi/mod.rs +++ b/crates/tauri-bundler/src/bundle/windows/msi/mod.rs @@ -753,7 +753,7 @@ pub fn build_wix_app_installer( } let main_wxs_path = output_path.join("main.wxs"); - fs::write(main_wxs_path.clone(), handlebars.render("main.wxs", &data)?)?; + fs::write(&main_wxs_path, handlebars.render("main.wxs", &data)?)?; let mut candle_inputs = vec![]; From a88fbe5ba1cf0334cc013c2f8465385d74890b55 Mon Sep 17 00:00:00 2001 From: chfaft <129761080+chfaft@users.noreply.github.com> Date: Mon, 1 Dec 2025 18:21:45 +0100 Subject: [PATCH 4/4] Update .changes/support-template-extensions.md chore(bundler): reclassify changes. Co-authored-by: Tony <68118705+Legend-Master@users.noreply.github.com> --- .changes/support-template-extensions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changes/support-template-extensions.md b/.changes/support-template-extensions.md index 13507913f5ef..8fa4654c9717 100644 --- a/.changes/support-template-extensions.md +++ b/.changes/support-template-extensions.md @@ -1,5 +1,5 @@ --- -tauri-bundler: minor:feat +tauri-bundler: patch:enhance --- Consider extensions that are defined in the wxs template.