diff --git a/.changes/fix-windows-exe-version.md b/.changes/fix-windows-exe-version.md new file mode 100644 index 00000000000..af4c0c2db5d --- /dev/null +++ b/.changes/fix-windows-exe-version.md @@ -0,0 +1,5 @@ +--- +"tauri-build": patch +--- + +Properly set file version information for the Windows executable. diff --git a/core/tauri-build/Cargo.toml b/core/tauri-build/Cargo.toml index 985aa452461..de3c369572a 100644 --- a/core/tauri-build/Cargo.toml +++ b/core/tauri-build/Cargo.toml @@ -26,6 +26,7 @@ serde_json = "1" [target."cfg(windows)".dependencies] winres = "0.1" +semver = "1" [features] codegen = [ "tauri-codegen", "quote" ] diff --git a/core/tauri-build/src/lib.rs b/core/tauri-build/src/lib.rs index 2adc2f552c4..bb8730e43d6 100644 --- a/core/tauri-build/src/lib.rs +++ b/core/tauri-build/src/lib.rs @@ -256,7 +256,8 @@ pub fn try_build(attributes: Attributes) -> Result<()> { #[cfg(windows)] { use anyhow::Context; - use winres::WindowsResource; + use semver::Version; + use winres::{VersionInfo, WindowsResource}; let icon_path_string = attributes .windows_attributes @@ -276,6 +277,11 @@ pub fn try_build(attributes: Attributes) -> Result<()> { } } if let Some(version) = &config.package.version { + if let Ok(v) = Version::parse(version) { + let version = v.major << 48 | v.minor << 32 | v.patch << 16; + res.set_version_info(VersionInfo::FILEVERSION, version); + res.set_version_info(VersionInfo::PRODUCTVERSION, version); + } res.set("FileVersion", version); res.set("ProductVersion", version); }