Skip to content

Conversation

@nkolev92
Copy link
Member

@nkolev92 nkolev92 commented Oct 3, 2022

Design for #5154

Rendered

cc @dsplaisted

Copy link

@Nirmal4G Nirmal4G left a 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. 😅🙃

@nkolev92
Copy link
Member Author

nkolev92 commented Oct 4, 2022

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.

@Nirmal4G
Copy link

Nirmal4G commented Oct 4, 2022

@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.

@Nirmal4G
Copy link

Nirmal4G commented Oct 4, 2022

Hoping to add more details about the scenarios and just in general provide more concrete proposals soon.

Sure, Will look though once you mark this ready for review. Sorry for the uninvited comments. I'll stop now.

@nkolev92
Copy link
Member Author

nkolev92 commented Oct 4, 2022

Hoping to add more details about the scenarios and just in general provide more concrete proposals soon.

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 :)

@JonDouglas
Copy link
Contributor

@ViktorHofer & @ericstj

@zivkan zivkan self-assigned this Nov 13, 2023
@zivkan zivkan marked this pull request as ready for review November 15, 2023 13:27
@zivkan zivkan requested a review from a team as a code owner November 15, 2023 13:27
@zivkan zivkan force-pushed the dev-nkolev92-tfmaliases branch from 55c6bba to 1c19625 Compare November 23, 2023 08:55
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

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.
Copy link

@ericstj ericstj Dec 11, 2023

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.

Copy link

@ViktorHofer ViktorHofer Dec 11, 2023

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.

@ghost
Copy link

ghost commented Jan 11, 2024

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.

@zivkan
Copy link
Member

zivkan commented Jan 26, 2024

oops, vacation and other priorities has kept this feature on the backburner, but it's still planned.

@Nigusu-Allehu Nigusu-Allehu added the Status:Do not auto close Do not auto close for PRs needs long review process label Jun 4, 2024
@zivkan zivkan marked this pull request as draft July 23, 2024 22:34
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.
Copy link

@jviau jviau Aug 6, 2025

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).

@nkolev92 nkolev92 force-pushed the dev-nkolev92-tfmaliases branch from ddc7fae to 413d370 Compare November 26, 2025 17:58
@nkolev92 nkolev92 assigned nkolev92 and unassigned zivkan Dec 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status:Do not auto close Do not auto close for PRs needs long review process

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants