diff --git a/.changes/fix-nsis-webviewloaderdll.md b/.changes/fix-nsis-webviewloaderdll.md new file mode 100644 index 000000000000..cc355a63504d --- /dev/null +++ b/.changes/fix-nsis-webviewloaderdll.md @@ -0,0 +1,5 @@ +--- +tauri-bundler: 'patch:bug' +--- + +Fixed an issue leading to NSIS based installers to not contain the `WebView2Loader.dll` file when targetting `windows-gnu`. diff --git a/crates/tauri-bundler/src/bundle/windows/nsis/mod.rs b/crates/tauri-bundler/src/bundle/windows/nsis/mod.rs index 248152d532a1..614aaad6e8c5 100644 --- a/crates/tauri-bundler/src/bundle/windows/nsis/mod.rs +++ b/crates/tauri-bundler/src/bundle/windows/nsis/mod.rs @@ -595,10 +595,24 @@ fn association_description( type ResourcesMap = BTreeMap; fn generate_resource_data(settings: &Settings) -> crate::Result { let mut resources = ResourcesMap::new(); + let cwd = std::env::current_dir()?; let mut added_resources = Vec::new(); + // Adding WebViewer2Loader.dll in case windows-gnu toolchain is used + if settings.target().ends_with("-gnu") { + let loader_path = + dunce::simplified(&settings.project_out_directory().join("WebView2Loader.dll")).to_path_buf(); + if loader_path.exists() { + added_resources.push(loader_path.clone()); + resources.insert( + loader_path, + (PathBuf::new(), PathBuf::from("WebView2Loader.dll")), + ); + } + } + for resource in settings.resource_files().iter() { let resource = resource?;