-
Notifications
You must be signed in to change notification settings - Fork 266
Design for allowing restore of multiple equivalent frameworks #12124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
Nirmal4G
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some ideas and suggestions. Feel free to ignore it. 😅🙃
proposed/2022/Multiple-Equivalent-Framework-Support-TFM-As-Aliases.md
Outdated
Show resolved
Hide resolved
proposed/2022/Multiple-Equivalent-Framework-Support-TFM-As-Aliases.md
Outdated
Show resolved
Hide resolved
proposed/2022/Multiple-Equivalent-Framework-Support-TFM-As-Aliases.md
Outdated
Show resolved
Hide resolved
proposed/2022/Multiple-Equivalent-Framework-Support-TFM-As-Aliases.md
Outdated
Show resolved
Hide resolved
proposed/2022/Multiple-Equivalent-Framework-Support-TFM-As-Aliases.md
Outdated
Show resolved
Hide resolved
proposed/2022/Multiple-Equivalent-Framework-Support-TFM-As-Aliases.md
Outdated
Show resolved
Hide resolved
proposed/2022/Multiple-Equivalent-Framework-Support-TFM-As-Aliases.md
Outdated
Show resolved
Hide resolved
proposed/2022/Multiple-Equivalent-Framework-Support-TFM-As-Aliases.md
Outdated
Show resolved
Hide resolved
proposed/2022/Multiple-Equivalent-Framework-Support-TFM-As-Aliases.md
Outdated
Show resolved
Hide resolved
|
Thanks for taking a look @Nirmal4G For context, this is design I'm still working on, I'd say it's at about 50%. Hoping to add more details about the scenarios and just in general provide more concrete proposals soon. |
|
@nkolev92 These are some of my observations and preliminary suggestions, ideas and takeaways from this draft. I'm not taking this as a concrete proposal. I'm just viewing this from a 10-foot view (or design perspective) of the proposal to see how it could impact normal as well as advanced users. In that mindset, read through my comments again. You would then see what I was talking about. |
Sure, Will look though once you mark this ready for review. Sorry for the uninvited comments. I'll stop now. |
Oh no worries. I appreciate the feedback as this is a large doc so getting feedback early on is always great. My comment was more about that fact that I'll be adding even more info to the doc, setting expectations about when something like this would even be close to happening :) |
proposed/2022/Multiple-Equivalent-Framework-Support-TFM-As-Aliases.md
Outdated
Show resolved
Hide resolved
55c6bba to
1c19625
Compare
| NuGet could require read a `RestoreAssetsFileVersion` property on each project, defaulting to 3 when not specified. | ||
| This allows project systems that have not yet adapted to the new assets file schema to keep working as before. | ||
|
|
||
| 1. Use the newer assets file automatically when a project multi-targets |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we use the new format only when the project multi-targets and there are multiple aliases that map to the same TargetFrameworkMoniker/TargetPlatformMoniker combination? That might avoid existing projects breaking with older tools.
|
|
||
| Currently `GetReferenceNearestTargetFrameworkTask` is implemented by running NuGet's "nearest match" algorithm. | ||
| This feature would extend it to first try nearest match, and if there is more than one matching `TargetFramework`, then look for a `TargetFramework` that has an exact name match in both projects. | ||
| If there are more than one "nearest" framework, but no exact name match, then for the first version of this feature, NuGet will report an error. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm interpreting this as supporting a case where you have a project that uses aliases referencing a project that's not using alias.
So if I have project 1 with TFs: net6.0-a;net6.0-b (where both are aliases for net6.0) and it referenced project 2 with TFs: net6.0;netstandard2.0 project1 could reference project 2 and select net6.0 because there is a single nearest framework.
If that's true this is a great middle ground for enabling aliases in a way that isn't viral.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The spec would benefit from an example to make the intent clear. I agree with your observation. Here are other examples that would work or not work with this algorithm:
Example 1
project1 net6.0-a;net6.0-b references project2 that references the same TFMs. Even though the GetReferenceNearestTargetFrameworkTask algorithm returns two matches, there's a single direct name match so it would choose net6.0-a from project2 for net6.0-a from project1 and same for net6.0-b.
Example 2
project1 net6.0 references project2 that references net6.0-a;net6.0-b. The GetReferenceNearestTargetFrameworkTask would algorithm returns two matches, there's no direct name match so the algorithm would fail and NuGet would report an error.
|
This PR has been automatically marked as stale because it has no activity for 30 days. It will be closed if no further activity occurs within another 15 days of this comment, unless it has a "Status:Do not auto close" label. If it is closed, you may reopen it anytime when you're ready again, as long as you don't delete the branch. |
|
oops, vacation and other priorities has kept this feature on the backburner, but it's still planned. |
accepted/2022/Multiple-Equivalent-Framework-Support-TFM-As-Aliases.md
Outdated
Show resolved
Hide resolved
| Should we consider more significant schema changes in the assets file? | ||
|
|
||
| Under `$/libraries`, each package lists every file in the package. | ||
| However, the performance penalty of needing to parse that list every time the assets file is read may be worse than any benefit it provides from avoiding enumerating the filesystem when it is needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For a functions extensibility scenario, I am considering having extension packages include a well-known marker file in their nupkg. I was going to leverage the fact that the assets file already has all nupkg file contents listed in it to speed up that process.
With this change, is the suggestion I would need to manually scan the file system of every nuget package? Or do you have an idea of a more general way I can add metadata to a nuget package and read it during a build?
Today we have an assembly attribute and we use Mono.Cecil to scan runtime assemblies from nuget looking for that attribute. This is understandably not performant. Which is why I am considering the marker file approach. I wouldn't block on this change just for our use case, but some metadata system for nupkgs that can be read at build time would be helpful (but obviously that would be an entirely different proposal).
1c19625 to
ddc7fae
Compare
ddc7fae to
413d370
Compare
Design for #5154
Rendered
cc @dsplaisted