Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(tauri-build): properly set executable version info on Windows #4045

Merged
merged 1 commit into from May 3, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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