Repository navigation
Fix BuildDateUtc embedding on Windows builds - #4666
Conversation
On Windows, Exec runs the command from a .cmd file, which consumed the single % in --format=%cI, so git failed and its error message was embedded as the build date. Double the % on Windows, and only embed the output when git succeeds and it looks like an ISO 8601 date. Fixes #4665 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
🔵 Needs a closer look
No blocking code issues were identified, but the Windows-specific command behavior still needs confirmation from Windows CI.
No open issues 🎉
What changed in this PR
This PR addresses #4665 by correcting commit-date embedding on Windows, which perpetual-license validation depends on.
Changes:
- Use platform-specific percent escaping for Git’s date format and embed output only when Git succeeds and it matches the expected date prefix.
- Add a regression test requiring
BuildInfo.BuildDateto be non-null, covered by the existing Windows release test run.
| File | Description |
|---|---|
| src/UnitTests/Licensing/BuildInfoTests.cs | Adds a regression test for the embedded build date. |
| src/AutoMapper/AutoMapper.csproj | Fixes Windows escaping and guards build-date metadata generation. |
Review effort: Balanced
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b7bef5f6a8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Fixes #4665
Problem
EmbedBuildDaterangit log -1 --format=%25cI. Packages are built on Windows, whereExecwrites the command to a.cmdfile. cmd consumes the single%, so git received--format=cIand failed. Because ofIgnoreExitCode="true", the error textfatal: invalid --pretty format: cIwas embedded asBuildDateUtcin 16.1.0, 16.1.1 and 16.2.0. As a result,BuildInfo.BuildDateisnulland perpetual licensing never applies.Changes
%%cIon Windows and%cIeverywhere else.Execexits with 0 and the output matches^\d{4}-\d{2}-\d{2}T. Otherwise no attribute is written. There is intentionally no fallback to the current time, so a rebuild from source can't extend perpetual coverage.BuildInfoTests.BuildDate_IsEmbedded.Build.ps1runs tests on the Windows runner before packing, so a regression now fails the release.Verification
2026-10-16T15:08:34-05:00.-p:OS=Windows_NT, which makes git output a literal%cI) makes the guard drop the value and the test fail, as intended.Releases 16.1.0–16.2.0 are still affected. Customers on those versions need to upgrade to get perpetual licensing.
🤖 Generated with Claude Code