Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Automatically use PackageReference mode if referencing a project that uses PackageReference #4581
I'm not sure how feasible this is, but we have a really poor experience referencing .NET Standard projects from .NET Framework projects today:
Here are issues I've found that people have filed after running into this:
Issue #4488 now tracks a way to opt-in to PackageReference mode without havinng any
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.
Restore could determine this, it always finds the full project to project reference graph and the restore style of each project.
However, wouldn't changing the behavior of an existing project to flow all references to it transitively be somewhat unexpected and possibly breaking? There would also be the scenario where the parent project uses packages.config and can't just switch over to using an assets file.
I wouldn't call this a breaking change for pre-VS2017 projects, because the behavior wouldn't change at all until you reference a project that uses
In general I agree with Rob that we need more thought and design for this. I do think it's important that we try to do something to improve the experience here.