Skip to content

Reference net11-bundled packages only on net8.0/net9.0/net10.0 - #9951

Merged
glen-84 merged 1 commit into
mainfrom
gai/condition-net11-framework-package-refs
Jun 18, 2026
Merged

glen-84 merged 1 commit into
mainfrom
gai/condition-net11-framework-package-refs

Conversation

@glen-84

@glen-84 glen-84 commented Jun 18, 2026

Copy link
Copy Markdown
Member

Summary

  • Several Microsoft.Extensions.* packages (DependencyInjection.Abstractions, Options, Primitives, Logging.Abstractions, Hosting.Abstractions) are now part of the .NET 11 shared framework. When a project is built single-target net11 (e.g. the Nitro CLI AOT release publish), NuGet package pruning raises NU1510 for the now-redundant direct references, failing the build under TreatWarningsAsErrors.
  • These references are now conditioned to net8.0/net9.0/net10.0 (the TFMs that still need them) so they are dropped on net11, where the framework provides them. The normal multi-target build was unaffected because pruning only triggers when it applies to every target.
  • Mirrors the existing System.Net.ServerSentEvents and System.IO.Pipelines handling.

Test plan

  • Reproduced the failing Nitro CLI net11/linux-musl-x64 restore — now clean (0 NU1510).
  • Swept all 53 framework-package-referencing projects across net8/9/10/11: 0 NU1510 remaining.
  • Built the affected projects single-target net11 and multi-target — all succeed.

Copilot AI 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.

Pull request overview

Adjusts project-level PackageReference entries so that packages now bundled by the .NET 11 shared framework are only referenced on TFMs that still require them, preventing NU1510 from failing single-target net11.0 builds under TreatWarningsAsErrors.

Changes:

  • Conditioned Microsoft.Extensions.* package references to only apply on net8.0/net9.0/net10.0, dropping them for net11.0.
  • Kept existing per-TFM handling patterns consistent with other framework-bundled packages (e.g., System.IO.Pipelines, System.Net.ServerSentEvents).

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/StrawberryShake/Client/src/Transport.WebSockets/StrawberryShake.Transport.WebSockets.csproj Condition Microsoft.Extensions.Options reference to net8/9/10 only.
src/StrawberryShake/Client/src/Transport.Http/StrawberryShake.Transport.Http.csproj Move Microsoft.Extensions.DependencyInjection.Abstractions into a net8/9/10-only ItemGroup.
src/StrawberryShake/Client/src/Core/StrawberryShake.Core.csproj Condition Microsoft.Extensions.DependencyInjection.Abstractions reference to net8/9/10 only.
src/Mocha/src/Mocha/Mocha.csproj Condition Hosting.Abstractions, Options, Primitives references to net8/9/10 only.
src/Mocha/src/Mocha.Threading/Mocha.Threading.csproj Condition Microsoft.Extensions.Logging.Abstractions reference to net8/9/10 only.
src/Mocha/src/Mocha.Mediator/Mocha.Mediator.csproj Move DependencyInjection.Abstractions and Options into a net8/9/10-only ItemGroup.
src/Mocha/src/Mocha.Abstractions/Mocha.Abstractions.csproj Condition Microsoft.Extensions.DependencyInjection.Abstractions reference to net8/9/10 only.
src/HotChocolate/Utilities/src/Utilities/HotChocolate.Utilities.csproj Condition Microsoft.Extensions.DependencyInjection.Abstractions reference to net8/9/10 only.
src/HotChocolate/PersistedOperations/src/PersistedOperations.Pipeline/HotChocolate.PersistedOperations.Pipeline.csproj Condition Microsoft.Extensions.DependencyInjection.Abstractions reference to net8/9/10 only.
src/HotChocolate/Fusion/src/Fusion.Execution/HotChocolate.Fusion.Execution.csproj Move Microsoft.Extensions.DependencyInjection.Abstractions into a net8/9/10-only ItemGroup.
src/HotChocolate/Fusion/src/Fusion.Execution.Types/HotChocolate.Fusion.Execution.Types.csproj Move Microsoft.Extensions.DependencyInjection.Abstractions into a net8/9/10-only ItemGroup.
src/HotChocolate/Core/src/Validation/HotChocolate.Validation.csproj Condition Microsoft.Extensions.DependencyInjection.Abstractions reference to net8/9/10 only.
src/HotChocolate/Core/src/Types/HotChocolate.Types.csproj Condition Microsoft.Extensions.Options reference to net8/9/10 only.
src/HotChocolate/Core/src/Subscriptions.Serializers.Newtonsoft/HotChocolate.Subscriptions.Serializers.Newtonsoft.csproj Move Microsoft.Extensions.DependencyInjection.Abstractions into a net8/9/10-only ItemGroup.
src/HotChocolate/Core/src/Subscriptions.Redis/HotChocolate.Subscriptions.Redis.csproj Move Microsoft.Extensions.DependencyInjection.Abstractions into a net8/9/10-only ItemGroup.
src/HotChocolate/Core/src/Subscriptions.InMemory/HotChocolate.Subscriptions.InMemory.csproj Condition Microsoft.Extensions.DependencyInjection.Abstractions reference to net8/9/10 only.
src/HotChocolate/Core/src/Execution.Pipeline/HotChocolate.Execution.Pipeline.csproj Condition Microsoft.Extensions.DependencyInjection.Abstractions reference to net8/9/10 only.
src/HotChocolate/Core/src/Execution.Configuration.Abstractions/HotChocolate.Execution.Configuration.Abstractions.csproj Condition Microsoft.Extensions.DependencyInjection.Abstractions reference to net8/9/10 only.
src/HotChocolate/Core/src/Execution.Abstractions/HotChocolate.Execution.Abstractions.csproj Condition Microsoft.Extensions.DependencyInjection.Abstractions reference to net8/9/10 only.
src/HotChocolate/Caching/src/Caching.Core/HotChocolate.Caching.Core.csproj Condition Microsoft.Extensions.Options reference to net8/9/10 only.
src/GreenDonut/src/GreenDonut/GreenDonut.csproj Move Microsoft.Extensions.DependencyInjection.Abstractions into a net8/9/10-only ItemGroup.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-code-quality

Copy link
Copy Markdown

Code Coverage Overview

Languages: C#

C# / code-coverage/dotnet

The overall coverage in the gai/condition-net11-... branch remains at 49%, unchanged from the main branch.

Show a code coverage summary of the most impacted files.
File main 6f419fa gai/condition-net11-... c4c5b1b +/-
/home/runner/wo...ddlewareBase.cs 72% 66% -6%
/home/runner/wo...PromiseCache.cs 81% 78% -3%
/home/runner/wo...PlanExecutor.cs 78% 77% -1%
/home/runner/wo...tocolHandler.cs 82% 83% +1%
/home/runner/wo...nManagerBase.cs 82% 83% +1%
/home/runner/wo...boxProcessor.cs 72% 74% +2%
/home/runner/wo...ueryExecutor.cs 65% 67% +2%
/home/runner/wo...gerMessage.g.cs 6% 10% +4%
/home/runner/wo...gerMessage.g.cs 11% 15% +4%
/home/runner/wo...eiveEndpoint.cs 69% 77% +8%

Code Coverage is in Public Preview. Learn more and provide us with your feedback.

@glen-84
glen-84 merged commit ff220e6 into main Jun 18, 2026
145 checks passed
@glen-84
glen-84 deleted the gai/condition-net11-framework-package-refs branch June 18, 2026 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants