Skip to content

Commit

Permalink
fix(tauri-build): properly set executable version info on Windows (#4045
Browse files Browse the repository at this point in the history
)
  • Loading branch information
lucasfernog committed May 3, 2022
1 parent 4562e67 commit 1ca2dd6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changes/fix-windows-exe-version.md
@@ -0,0 +1,5 @@
---
"tauri-build": patch
---

Properly set file version information for the Windows executable.
1 change: 1 addition & 0 deletions core/tauri-build/Cargo.toml
Expand Up @@ -26,6 +26,7 @@ serde_json = "1"

[target."cfg(windows)".dependencies]
winres = "0.1"
semver = "1"

[features]
codegen = [ "tauri-codegen", "quote" ]
Expand Down
8 changes: 7 additions & 1 deletion core/tauri-build/src/lib.rs
Expand Up @@ -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
Expand All @@ -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);
}
Expand Down

0 comments on commit 1ca2dd6

Please sign in to comment.