Skip to content

Allow metadata on FrameworkReference such that no references are actually raised #53106

@wtgodbe

Description

@wtgodbe

I just opened dotnet/aspnetcore#65478 to solve a problem in aspnetcore: We build our projects with ProjectReferences, but for OOB packages that have references to SharedFx-only libraries, those packages need to wind up with a FrameworkReference to Microsoft.AspNetCore.App in their .nuspec (we used to achieve this by manually re-writing the .nuspec post-build).

The new approach is to add the FrameworkReference so that restore generates a project.assets.json w/ the FrameworkReference, then hook a target before ResolveFrameworkReferences that removes it, so it doesn't actually get used. We also have to set IsTransitiveFrameworkReference=true on the FrameworkRef so that pruning warnings don't fire. It would be better if there was some metadata we could set on the FrameworkReference (like "NuspecOnly" or "DoNotRaiseAssets") so that it'd wind up in the assets file/nuspec, but its references wouldn't actually get used.

I tried "ExcludeAssets=all" but the compiler still gets references from the FrameworkReference.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions