Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 15, 2025

The -extra base image variant was only applied for .NET 8 due to an equality check instead of a range check, breaking support for .NET 9 and later.

Changes

  • Fixed version comparison in ComputeDotnetBaseImageAndTag.cs:

    • Changed parsedVersion.Major == FirstVersionWithNewTaggingScheme to parsedVersion.Major >= FirstVersionWithNewTaggingScheme
    • Ensures .NET 8+ applications using chiseled containers without InvariantGlobalization correctly receive the -extra variant containing ICU and tzdata
  • Added test coverage for .NET 9 and .NET 10:

    • FDDConsoleAppWithCulturesAndOptingIntoChiseledGetsExtrasForNet9AndLater
    • FDDAspNetAppWithCulturesAndOptingIntoChiseledGetsExtrasForNet9AndLater
    • Verify console and ASP.NET apps get correct -extra tags for future SDK versions

Context

The -extra variants became available starting with .NET 8's new tagging scheme. The original implementation incorrectly hard-coded the version check to exactly 8, preventing the logic from working with newer SDK versions.

// Before: Only .NET 8
&& (!parsedVersion.IsPrerelease && parsedVersion.Major == FirstVersionWithNewTaggingScheme)

// After: .NET 8 and all future versions
&& (!parsedVersion.IsPrerelease && parsedVersion.Major >= FirstVersionWithNewTaggingScheme)
Original prompt

This section details on the original issue you should resolve

<issue_title>How to use "-extra" base image via InvariantGlobalization?</issue_title>
<issue_description>This is a bug in the containers targets - when we check if we can add the -extra variant to the users' ContainerFamily, we check if the target runtime == 8, not >= 8 (when the -extras first became available).

We should fix this comparison and add tests to the existing targets test to verify the expected behavior.

Discussed in #52158

Originally posted by mu88 December 15, 2025
Hi @baronfel,

When using the .NET SDK Container Building Tools and setting the MSBuild property InvariantGlobalization to false, the base image with the -extra suffix is not used:
image

Based on the log statement Using user-provided ContainerFamily, I was able to find this spot in the code.
However, I'm wondering about why I'm not ending up here 🤔

Do you have a hint for me?

Here's my repro workflow:

  1. dotnet new webapi
  2. dotnet publish /t:PublishContainer /p:InvariantGlobalization=false /p:ContainerRuntimeIdentifier=linux-x64 /p:ContainerFamily=noble-chiseled /bl
  3. Open the MSBuild log with MSBuild Structured Log Viewer
</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

… .NET 9/10

Co-authored-by: baronfel <573979+baronfel@users.noreply.github.com>
@baronfel baronfel requested a review from a team December 15, 2025 15:55
@baronfel baronfel marked this pull request as ready for review December 15, 2025 15:55
Copilot AI review requested due to automatic review settings December 15, 2025 15:55
Copilot AI and others added 2 commits December 15, 2025 16:01
Co-authored-by: baronfel <573979+baronfel@users.noreply.github.com>
Co-authored-by: baronfel <573979+baronfel@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix comparison for -extra base image in ContainerFamily Fix -extra container variant check to support .NET 9+ Dec 15, 2025
Copilot AI requested a review from baronfel December 15, 2025 16:07
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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.

How to use "-extra" base image via InvariantGlobalization?

2 participants