Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changes/nsis-stock-plugins-embed-signed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tauri-bundler": "patch:bug"
---

Fix NSIS stock plugins (`NSISdl.dll`, `StartMenu.dll`, `System.dll`, `nsDialogs.dll`) being embedded in the final installer as unsigned despite the signing step succeeding. The signed local copies under `<output>/Plugins/x86-unicode/` were not on makensis' plugin search path, so makensis fell back to the unsigned DLLs from the NSIS toolset directory. The fix adds `!addplugindir` for the signed plugin directory before any plugin command is parsed in the script.
6 changes: 6 additions & 0 deletions crates/tauri-bundler/src/bundle/windows/nsis/installer.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ ManifestDPIAwareness PerMonitorV2
SetCompressor /SOLID "{{compression}}"
!endif

; Keep above !include to stay ahead of any plugin command
; see https://github.com/tauri-apps/tauri/pull/15422#discussion_r3289239624
{{#if signed_plugins_path}}
!addplugindir "{{signed_plugins_path}}"
{{/if}}

!include MUI2.nsh
!include FileFunc.nsh
!include x64.nsh
Expand Down
20 changes: 13 additions & 7 deletions crates/tauri-bundler/src/bundle/windows/nsis/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::{
},
},
},
error::ErrorExt,
error::{bail, ErrorExt},
utils::{
http_utils::{download_and_verify, verify_file_hash, HashAlgorithm},
CommandExt,
Expand Down Expand Up @@ -282,6 +282,13 @@ fn build_nsis_app_installer(
to_json(&additional_plugins_path),
);

if let Some(plugin_copy_path) = &maybe_plugin_copy_path {
data.insert(
"signed_plugins_path",
to_json(plugin_copy_path.join("x86-unicode")),
);
}

data.insert("arch", to_json(arch));
data.insert("bundle_id", to_json(bundle_id));
data.insert("manufacturer", to_json(manufacturer));
Expand Down Expand Up @@ -650,7 +657,7 @@ fn build_nsis_app_installer(
);

let nsis_output_path = output_path.join(out_file);
let nsis_installer_path = settings.project_out_directory().to_path_buf().join(format!(
let nsis_installer_path = settings.project_out_directory().join(format!(
"bundle/{}/{}.exe",
if updater {
NSIS_UPDATER_OUTPUT_FOLDER_NAME
Expand Down Expand Up @@ -683,11 +690,7 @@ fn build_nsis_app_installer(
#[cfg(not(target_os = "windows"))]
let mut nsis_cmd = Command::new("makensis");

if let Some(plugins_path) = &maybe_plugin_copy_path {
nsis_cmd.env("NSISPLUGINS", plugins_path);
}

nsis_cmd
let status = nsis_cmd
.args(["-INPUTCHARSET", "UTF8", "-OUTPUTCHARSET", "UTF8"])
.arg(match settings.log_level() {
log::Level::Error => "-V1",
Expand All @@ -704,6 +707,9 @@ fn build_nsis_app_installer(
command: "makensis.exe".to_string(),
error,
})?;
if !status.success() {
bail!("Failed to bundle app with makensis");
}

fs::rename(nsis_output_path, &nsis_installer_path)?;

Expand Down
Loading