You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Perpetual licensing never applies: BuildDateUtc in the published package contains a git error message #4665
Affected version: AutoMapper 16.2.0 (latest on NuGet), all target frameworks (net8.0, net9.0, net10.0, netstandard2.0, net471)
Description
Perpetual licensing relies on the assembly metadata BuildDateUtc (src/AutoMapper/Licensing/BuildInfo.cs). In the assemblies of the published NuGet package this value is not a date but the output of a failed git call: fatal: invalid --pretty format: cI.
Steps to reproduce
Create a console app and add the package AutoMapper 16.2.0.
Expected:BuildDateUtc holds the commit date of the release and TryParse returns True.
Consequence
BuildInfo.BuildDate is null, so LicenseValidator never applies perpetual licensing. With a perpetual license, once the key has expired every start-up logs
Warning: Your license for the Lucky Penny software AutoMapper has the perpetual flag set, but the build date could not be determined. Perpetual licensing is unavailable.
Error: Your license for the Lucky Penny software AutoMapper expired N days ago.
although the package was built before the expiry of the license and should be covered by the perpetual license.
Cause (presumably)
The target EmbedBuildDate in src/AutoMapper/AutoMapper.csproj runs
The package is built on Windows (Build.ps1). There, Exec writes the command to a temporary .cmd file, where the single % is consumed by batch variable expansion, so git receives --format=cI and fails. Because of IgnoreExitCode="true" the error output ends up in BuildDateUtc. The line is unchanged on main.
Suggested fix
Make the git call work under cmd (e.g. double the % when building on Windows, or obtain the commit date without a % format string),
only use the output if Exec succeeded and it parses as a date, otherwise fall back, and
add a test that the built assembly contains a parseable BuildDateUtc, so this cannot regress silently.
Thanks for the detailed report and diagnosis. You were right about the cause. It's fixed in #4666.
Affected versions: in these published packages, BuildDateUtc contains the git error instead of a date, so perpetual licensing never applies:
15.1.1 and 15.1.2
16.1.0, 16.1.1 and 16.2.0
Earlier versions and 15.1.3 don't include the perpetual licensing check, so they aren't affected.
What to do: the fix is merged to main and will be in the next AutoMapper release. If you have a perpetual license, upgrade to that release once it's published, and perpetual licensing will apply as expected. Until then, the warning and expiry messages above will keep being logged at startup on the affected versions.
The release build now also fails if the build date can't be embedded, so this can't regress silently.
A correction to my earlier comment, now that we've confirmed how the 15.x line works.
Perpetual licensing is only supported on 16.x. The 15.x line only receives critical bug fixes and security fixes, and genuine 15.x releases (15.1.0 and 15.1.3) don't include perpetual licensing.
15.1.1 and 15.1.2 included it only because they were built from 16.x code by mistake (see #4620). Those versions are now deprecated and unlisted on NuGet.
If you have a perpetual license, upgrade to the next 16.x release. That applies whether you're on 16.1.0–16.2.0 or on 15.1.1/15.1.2.
Activity
jbogard commentedon Oct 26, 2026
Thanks for the detailed report and diagnosis. You were right about the cause. It's fixed in #4666.
Affected versions: in these published packages,
BuildDateUtccontains the git error instead of a date, so perpetual licensing never applies:Earlier versions and 15.1.3 don't include the perpetual licensing check, so they aren't affected.
What to do: the fix is merged to
mainand will be in the next AutoMapper release. If you have a perpetual license, upgrade to that release once it's published, and perpetual licensing will apply as expected. Until then, the warning and expiry messages above will keep being logged at startup on the affected versions.The release build now also fails if the build date can't be embedded, so this can't regress silently.
Fix BuildDateUtc embedding on Windows builds
jbogard commentedon Oct 26, 2026
A correction to my earlier comment, now that we've confirmed how the 15.x line works.
Perpetual licensing is only supported on 16.x. The 15.x line only receives critical bug fixes and security fixes, and genuine 15.x releases (15.1.0 and 15.1.3) don't include perpetual licensing.
15.1.1 and 15.1.2 included it only because they were built from 16.x code by mistake (see #4620). Those versions are now deprecated and unlisted on NuGet.
If you have a perpetual license, upgrade to the next 16.x release. That applies whether you're on 16.1.0–16.2.0 or on 15.1.1/15.1.2.