Skip to content

Discussion about how references are defined in libraries #48238

@ViktorHofer

Description

@ViktorHofer

In runtime's libraries there are different ways to reference a dependency:

  • ProjectReference: If a compatible live configuration of a dependency exists, a ProjectReference should be used. Exception: $(NetCoreAppCurrent) targeting pack references from runtime pack assemblies are currently not represented as ProjectReference but Reference items to minimize incremental build costs (including netstandard.dll).
  • Reference: If a compatible live configuration of a dependency doesn't exist and the assembly is part of the targeting pack (framework reference), a Reference should be used.
  • PackageReference: If a compatible live configuration of a dependency doesn't exist and the assembly isn't part of the targeting pack (framework reference), a PackageReference should be used. Example: System.Memory for netstandard2.0.

For someone who doesn't work full time on runtime's infrastructure, it's hard to reason about when to use which of the ItemTypes above. AspNetCore doesn't use ProjectReference items in the project file and dynamically construct the ProjectReference items based on Reference items.

I would like to discuss if it there's value in simplifying how references in runtime's libraries are defined. This could be accomplished by consolidating on one of the above item types or by introducing a new one i.e. DynamicReference.

Requirements

Such a system needs to work with "msbuild static graph" which we depend on to restore projects. That said, it should be fine to depend on a target, as static graph restore invokes certain targets and static graph build (from my perspective) will likely need to support that as well.

Additional information

  • The DisableImplicitFrameworkReferences msbuild property defines if a targeting pack is "consumed" by the project. In dotnet/runtime this property defaults to true for $(NetCoreAppCurrent) ref and src assemblies which are inbox.

@ericstj @joperezr @safern @Anipik @eerhardt and @dougbu @wtgodbe (for thoughts about what aspnetcore's infra does well and what not)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions