Skip to content

Add explicit PackageReferences for transitive Microsoft.Extensions.* …#5211

Open
DrewScoggins wants to merge 3 commits intodotnet:mainfrom
DrewScoggins:fix-extensions-explicit-abstractions
Open

Add explicit PackageReferences for transitive Microsoft.Extensions.* …#5211
DrewScoggins wants to merge 3 commits intodotnet:mainfrom
DrewScoggins:fix-extensions-explicit-abstractions

Conversation

@DrewScoggins
Copy link
Copy Markdown
Member

…abstractions

For .NET 10+, NuGet package pruning removes transitive Microsoft.Extensions.* abstractions (Logging.Abstractions, DependencyInjection.Abstractions, Options, Primitives) from project.assets.json because they are in-band in Microsoft.AspNetCore.App. Without them, the build fails with CS0246 for types like ILogger, IChangeToken, ObjectFactory, StringSegment, etc.

Disabling pruning via RestoreEnablePackagePruning=false (PR #5209) only preserves DIRECT PackageReferences. Transitive prunable deps are still removed. Add them as explicit PackageReferences so they remain app-local for BenchmarkDotNet's corerun toolchain (which targets a Microsoft.NETCore.App CoreRoot that does not include the AspNetCore.App shared framework).

Also re-enable Microsoft.Extensions.Primitives for net10+ (PR #5196 wrongly removed it assuming it was in NETCore.App; it is actually in AspNetCore.App).

…abstractions

For .NET 10+, NuGet package pruning removes transitive Microsoft.Extensions.*
abstractions (Logging.Abstractions, DependencyInjection.Abstractions, Options,
Primitives) from project.assets.json because they are in-band in
Microsoft.AspNetCore.App. Without them, the build fails with CS0246 for types
like ILogger, IChangeToken, ObjectFactory, StringSegment, etc.

Disabling pruning via RestoreEnablePackagePruning=false (PR #5209) only
preserves DIRECT PackageReferences. Transitive prunable deps are still
removed. Add them as explicit PackageReferences so they remain app-local
for BenchmarkDotNet's corerun toolchain (which targets a Microsoft.NETCore.App
CoreRoot that does not include the AspNetCore.App shared framework).

Also re-enable Microsoft.Extensions.Primitives for net10+ (PR #5196 wrongly
removed it assuming it was in NETCore.App; it is actually in AspNetCore.App).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 27, 2026 16:02
LoopedBard3
LoopedBard3 previously approved these changes Apr 27, 2026
Copy link
Copy Markdown
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.

Same root cause: NuGet pruning removes this transitive dep on net10+,
causing CS0246 for IConfiguration in ConfigurationBinderBenchmarks.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
LoopedBard3
LoopedBard3 previously approved these changes Apr 27, 2026
Same root cause: NuGet pruning removes this transitive dep on net10+,
causing CS0012/CS0246 for ICacheEntry and IMemoryCache.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 27, 2026 20:46
Copy link
Copy Markdown
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.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.


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

Comment on lines +113 to +115
(Logging.Abstractions, DependencyInjection.Abstractions, Options) from the resolution graph
because they are in-band in Microsoft.AspNetCore.App. We need them as direct PackageReferences
so they remain app-local for BenchmarkDotNet's corerun toolchain (which targets a
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

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

The comment lists only Logging.Abstractions/DependencyInjection.Abstractions/Options, but this ItemGroup also adds Caching.Abstractions and Configuration.Abstractions. Update the comment to reflect the full set of explicit abstractions being added (or clarify why those two are included).

Suggested change
(Logging.Abstractions, DependencyInjection.Abstractions, Options) from the resolution graph
because they are in-band in Microsoft.AspNetCore.App. We need them as direct PackageReferences
so they remain app-local for BenchmarkDotNet's corerun toolchain (which targets a
(Caching.Abstractions, Configuration.Abstractions, Logging.Abstractions,
DependencyInjection.Abstractions, Options) from the resolution graph because they are
in-band in Microsoft.AspNetCore.App. We need them as direct PackageReferences so they
remain app-local for BenchmarkDotNet's corerun toolchain (which targets a

Copilot uses AI. Check for mistakes.
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.

3 participants