mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-02-06 14:17:02 +00:00
fix(tauri-build): properly set executable version info on Windows (#4045)
This commit is contained in:
parent
4562e671e4
commit
1ca2dd677d
5
.changes/fix-windows-exe-version.md
Normal file
5
.changes/fix-windows-exe-version.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"tauri-build": patch
|
||||
---
|
||||
|
||||
Properly set file version information for the Windows executable.
|
||||
@ -26,6 +26,7 @@ serde_json = "1"
|
||||
|
||||
[target."cfg(windows)".dependencies]
|
||||
winres = "0.1"
|
||||
semver = "1"
|
||||
|
||||
[features]
|
||||
codegen = [ "tauri-codegen", "quote" ]
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user