Repository: tauri-apps/tauri
File: crates/tauri-bundler/src/bundle/windows/msi/mod.rs (Rust)

Code before:
    let temp_ps1_path = output_path.join("install-task.ps1");
    fs::write(temp_ps1_path, install_script_content)?;

    // Create the Powershell script to uninstall the task
    let mut skip_uac_task_uninstaller = Handlebars::new();
    skip_uac_task_uninstaller.register_escape_fn(handlebars::no_escape);
    let xml = include_str!("./uninstall-task.ps1");
    let install_script_content = skip_uac_task_uninstaller.render_template(xml, &data)?;
    let temp_ps1_path = output_path.join("uninstall-task.ps1");
    fs::write(temp_ps1_path, install_script_content)?;

    data.insert("enable_elevated_update_task", to_json(true));
  }

  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 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_handle_bars = Handlebars::new();
    let fragment = fragment_handle_bars.render_template(&fragment_content, &data)?;
    let mut extensions = Vec::new();
    for cap in extension_regex.captures_iter(&fragment) {
      extensions.push(wix_toolset_path.join(format!("Wix{}.dll", &cap[1])));
    }
    candle_inputs.push((fragment_path, extensions));
  }

  let mut fragment_extensions = HashSet::new();
  //Default extensions
  fragment_extensions.insert(wix_toolset_path.join("WixUIExtension.dll"));
  fragment_extensions.insert(wix_toolset_path.join("WixUtilExtension.dll"));

  for (path, extensions) in candle_inputs {
    for ext in &extensions {
      fragment_extensions.insert(ext.clone());
    }
    run_candle(settings, wix_toolset_path, &output_path, path, extensions)?;
  }

  let mut output_paths = Vec::new();

  for (language, language_config) in configured_languages.0 {
    let language_metadata = language_map.get(&language).unwrap_or_else(|| {
      panic!(
        "Language {} not found. It must be one of {}",

Review comment (suggestion):
```suggestion
    let fragment_handlebars = Handlebars::new();
    let fragment = fragment_handlebars.render_template(&fragment_content, &data)?;
```

Code after:
    let temp_ps1_path = output_path.join("install-task.ps1");
    fs::write(temp_ps1_path, install_script_content)?;

    // Create the Powershell script to uninstall the task
    let mut skip_uac_task_uninstaller = Handlebars::new();
    skip_uac_task_uninstaller.register_escape_fn(handlebars::no_escape);
    let xml = include_str!("./uninstall-task.ps1");
    let install_script_content = skip_uac_task_uninstaller.render_template(xml, &data)?;
    let temp_ps1_path = output_path.join("uninstall-task.ps1");
    fs::write(temp_ps1_path, install_script_content)?;

    data.insert("enable_elevated_update_task", to_json(true));
  }

  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 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 mut extensions = Vec::new();
    for cap in extension_regex.captures_iter(&fragment) {
      extensions.push(wix_toolset_path.join(format!("Wix{}.dll", &cap[1])));
    }
    candle_inputs.push((fragment_path, extensions));
  }

  let mut fragment_extensions = HashSet::new();
  //Default extensions
  fragment_extensions.insert(wix_toolset_path.join("WixUIExtension.dll"));
  fragment_extensions.insert(wix_toolset_path.join("WixUtilExtension.dll"));

  for (path, extensions) in candle_inputs {
    for ext in &extensions {
      fragment_extensions.insert(ext.clone());
    }
    run_candle(settings, wix_toolset_path, &output_path, path, extensions)?;
  }

  let mut output_paths = Vec::new();

  for (language, language_config) in configured_languages.0 {
    let language_metadata = language_map.get(&language).unwrap_or_else(|| {
      panic!(
        "Language {} not found. It must be one of {}",