Skip to content

Automatically use PackageReference mode if referencing a project that uses PackageReference #4581

Open
@dsplaisted

Description

I'm not sure how feasible this is, but we have a really poor experience referencing .NET Standard projects from .NET Framework projects today:

  • Create a .NET Standard Library project
  • Create a .NET Framework Console app
  • Reference the .NET Standard Library from the Console app
  • Get FileNotFoundException at runtime, depending on what APIs you use

Here are issues I've found that people have filed after running into this:

dotnet/standard#202
dotnet/sdk#757
dotnet/sdk#766
dotnet/sdk#747
dotnet/standard#192

Issue #4488 now tracks a way to opt-in to PackageReference mode without havinng any PackageReference items in a project. However, you would have to know to opt in, so this would still be a common pit of failure.

Ideally, we could automatically detect when a project references another project that's in PackageReference mode, and automatically use PackageReference mode in the referencing project. We might be able to return metadata from one of the targets that's called on project references to help with this. However, by the time we call that target it might be too late- we may need to decide on the restore mode before then. If that's the case then it could still be helpful to generate an error or warning letting people know how to opt in to PackageReference mode.

@nguerrera @rainersigwald for feedback on how we could pass this information between projects as metadata

@rrelyea @emgarten for general FYI

Metadata

Assignees

No one assigned

    Labels

    Priority:3Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog.Triage:NeedsDesignSpecType:DCRDesign Change Request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions