Skip to content

Package Pruning doesn't work if framework is pulled in transitively by library - Improving the experience when Package pruning underprunes when FrameworkReference is transitive #14747

@mus65

Description

@mus65

NuGet Product Used

dotnet.exe

Product Version

.NET SDK 10.0.102

Worked before?

No response

Impact

It bothers me. A fix would be nice

Repro Steps & Context

If the Microsoft.AspNetCore.App framework is not referenced by the application itself, but pulled in by a referenced library, package pruning does not seem to work.

I created a repro here: https://github.com/mus65/nuget-packagepruning-issue

To repro:

dotnet build
dotnet nuget why app/app.csproj Microsoft.AspNetCore.Authentication

This will say that Microsoft.AspNetCore.Authentication is pulled in by CoreWCF.Http, but it should be pruned instead.

Workaround: use Microsoft.NET.Sdk.Web in application or add framework reference Microsoft.AspNetCore.App to application.

Verbose Logs

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions