From b7bef5f6a8c0f900db6bc79af80cae110844c54e Mon Sep 17 00:00:00 2001 From: Jimmy Bogard Date: Thu, 22 Oct 2026 14:12:10 +0200 Subject: [PATCH] Fix BuildDateUtc embedding on Windows builds 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 --- src/AutoMapper/AutoMapper.csproj | 10 ++++++++-- src/UnitTests/Licensing/BuildInfoTests.cs | 10 ++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 src/UnitTests/Licensing/BuildInfoTests.cs diff --git a/src/AutoMapper/AutoMapper.csproj b/src/AutoMapper/AutoMapper.csproj index 2e1bcd97bf..f05e2df5ad 100644 --- a/src/AutoMapper/AutoMapper.csproj +++ b/src/AutoMapper/AutoMapper.csproj @@ -62,11 +62,17 @@ --> - + + + %25%25cI + %25cI + + + - $(GitCommitDate) + $(GitCommitDate) diff --git a/src/UnitTests/Licensing/BuildInfoTests.cs b/src/UnitTests/Licensing/BuildInfoTests.cs new file mode 100644 index 0000000000..b27682ee06 --- /dev/null +++ b/src/UnitTests/Licensing/BuildInfoTests.cs @@ -0,0 +1,10 @@ +using AutoMapper.Licensing; + +namespace AutoMapper.UnitTests.Licensing; + +public class BuildInfoTests +{ + // Perpetual licensing depends on the build date embedded by the EmbedBuildDate target + [Fact] + public void BuildDate_IsEmbedded() => BuildInfo.BuildDate.ShouldNotBeNull(); +}