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

Code before:
    let xml = include_str!("./update-task.xml");
    let update_content = skip_uac_task.render_template(xml, &data)?;
    let temp_xml_path = output_path.join("update.xml");
    fs::write(temp_xml_path, update_content)?;

    // Create the Powershell script to install the task
    let mut skip_uac_task_installer = Handlebars::new();
    skip_uac_task_installer.register_escape_fn(handlebars::no_escape);
    let xml = include_str!("./install-task.ps1");
    let install_script_content = skip_uac_task_installer.render_template(xml, &data)?;
    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.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(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)?;
    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(&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((input_path, extensions));
  }

  let mut fragment_extensions = HashSet::new();
  //Default extensions

Review comment (suggestion):
```suggestion
  fs::write(&main_wxs_path, handlebars.render("main.wxs", &data)?)?;
```

Code after:
    let xml = include_str!("./update-task.xml");
    let update_content = skip_uac_task.render_template(xml, &data)?;
    let temp_xml_path = output_path.join("update.xml");
    fs::write(temp_xml_path, update_content)?;

    // Create the Powershell script to install the task
    let mut skip_uac_task_installer = Handlebars::new();
    skip_uac_task_installer.register_escape_fn(handlebars::no_escape);
    let xml = include_str!("./install-task.ps1");
    let install_script_content = skip_uac_task_installer.render_template(xml, &data)?;
    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![];

  let current_dir = std::env::current_dir()?;
  let extension_regex = Regex::new("\"http://schemas.microsoft.com/wix/(\\w+)\"")?;
  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)?;
    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(&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((input_path, extensions));
  }

  let mut fragment_extensions = HashSet::new();
  //Default extensions