Skip to content

fix(tauri-build): preserve numeric semver build metadata in Windows FILEVERSION - #15289

Merged
Legend-Master merged 5 commits into
tauri-apps:devfrom
Pagecran:fix/windows-fileversion-build-metadata-pr2
Apr 27, 2026
Merged

fix(tauri-build): preserve numeric semver build metadata in Windows FILEVERSION#15289
Legend-Master merged 5 commits into
tauri-apps:devfrom
Pagecran:fix/windows-fileversion-build-metadata-pr2

Conversation

@pascalandr

@pascalandr pascalandr commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR preserves a numeric semver build identifier in the 4th segment of the Windows FILEVERSION fixed field.

Today, tauri-build projects config.version into the Windows fixed version fields as major.minor.patch.0, which means versions such as 1.2.3+42 always become 1.2.3.0 even though the numeric build identifier is representable in the Windows 4th segment.

This PR keeps the current major.minor.patch projection and preserves the build metadata only when it is:

  • numeric
  • representable as u16

Otherwise, behavior stays unchanged and the 4th segment remains 0.

PRODUCTVERSION is unchanged.

Why this is safe

  • single-file change in the existing Windows version block
  • no new API surface
  • no behavior change when build metadata is absent, non-numeric, composite, or out of range
  • parsing now matches the stricter numeric handling already used in the Windows NSIS code path
  • includes unit tests for numeric, composite, non-numeric, and out-of-range build metadata

Verification

  • cargo test -p tauri-build

@pascalandr
pascalandr requested a review from a team as a code owner April 23, 2026 11:37
@github-actions

github-actions Bot commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

Package Changes Through 7b81ffb

There are 11 changes which include tauri with minor, @tauri-apps/api with minor, tauri-build with minor, tauri-macos-sign with patch, tauri-bundler with minor, @tauri-apps/cli with minor, tauri-cli with minor, tauri-runtime with minor, tauri-runtime-wry with minor, tauri-utils with minor, tauri-plugin with minor

Planned Package Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
@tauri-apps/api 2.10.1 2.11.0
tauri-utils 2.8.3 2.9.0
tauri-macos-sign 2.3.3 2.3.4
tauri-bundler 2.8.1 2.9.0
tauri-runtime 2.10.1 2.11.0
tauri-runtime-wry 2.10.1 2.11.0
tauri-codegen 2.5.5 2.5.6
tauri-macros 2.5.5 2.5.6
tauri-plugin 2.5.4 2.6.0
tauri-build 2.5.6 2.6.0
tauri 2.10.3 2.11.0
@tauri-apps/cli 2.10.1 2.11.0
tauri-cli 2.10.1 2.11.0

Add another change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

@pascalandr
pascalandr force-pushed the fix/windows-fileversion-build-metadata-pr2 branch 2 times, most recently from cc99658 to c041010 Compare April 23, 2026 15:53
@Legend-Master

Copy link
Copy Markdown
Contributor

The semver metadata doesn't directly translate to a revision number in FILEVERSION, I don't think we should do this to be honest

@pascalandr

Copy link
Copy Markdown
Contributor Author

I agree it's not a strict semantic mapping.
My point is just that FILEVERSION and PRODUCTVERSION currently both collapse to major.minor.patch.0, so 1.2.3+41 and 1.2.3+42 become indistinguishable in fixed Windows version info.
This PR only preserves an already-numeric build identifier in FILEVERSION; otherwise behavior stays unchanged.

@Legend-Master

Copy link
Copy Markdown
Contributor

I feel like this behavior could be quite unexpected for many people, although it won't really do any harm. Especially since we don't handle other types of metadata/pre-release data

@FabianLars any opinions on this?

@FabianLars

Copy link
Copy Markdown
Member

hmm i think that's fine? we do a similar conversion in the .msi already

@Legend-Master Legend-Master left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, let's do this then

Comment thread crates/tauri-build/src/lib.rs Outdated
@pascalandr

Copy link
Copy Markdown
Contributor Author

Addressed in a1d29fd.

The build metadata handling now matches the stricter NSIS approach: it must parse as a whole u16, and composite metadata like +42.sha now falls back to 0 instead of using the first segment.

@pascalandr
pascalandr force-pushed the fix/windows-fileversion-build-metadata-pr2 branch from a1d29fd to 6ede795 Compare April 24, 2026 05:48
Comment thread crates/tauri-build/src/lib.rs Outdated
Comment thread crates/tauri-build/src/lib.rs Outdated
Comment thread crates/tauri-build/src/lib.rs Outdated

@Legend-Master Legend-Master left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll also need to run cargo fmt

@Legend-Master Legend-Master left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Legend-Master
Legend-Master merged commit b3f2d12 into tauri-apps:dev Apr 27, 2026
19 checks passed
razein97 pushed a commit to razein97/tauri that referenced this pull request Apr 30, 2026
…ILEVERSION (tauri-apps#15289)

* fix(tauri-build): preserve numeric semver build metadata in Windows FILEVERSION

* refactor(tauri-build): clarify PRODUCTVERSION naming

* refactor(tauri-build): align fixed Windows version fields

* refactor(tauri-build): rename Windows version helper

* style(tauri-build): move winres helper near tests
razein97 pushed a commit to razein97/tauri that referenced this pull request Apr 30, 2026
…ILEVERSION (tauri-apps#15289)

* fix(tauri-build): preserve numeric semver build metadata in Windows FILEVERSION

* refactor(tauri-build): clarify PRODUCTVERSION naming

* refactor(tauri-build): align fixed Windows version fields

* refactor(tauri-build): rename Windows version helper

* style(tauri-build): move winres helper near tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants