Migrate LegacyPackageReferenceProject to PackageSpecFactory#7263
Merged
Conversation
nkolev92
reviewed
Apr 8, 2026
nkolev92
reviewed
Apr 8, 2026
Member
nkolev92
left a comment
There was a problem hiding this comment.
Small comment, that's a bit opinionated, but curious what you think.
Lots of code, especially test code, so hopefully I looked at all the importance things.
lmk if there's something in particular that needs a more detailed look.
kartheekp-ms
reviewed
Apr 9, 2026
nkolev92
previously approved these changes
Apr 10, 2026
jeffkl
previously approved these changes
Apr 13, 2026
4dc6d5a to
a08af57
Compare
jeffkl
previously approved these changes
Apr 15, 2026
Member
|
you have a bad rebase @zivkan ping when you've fixed it. |
jeffkl
approved these changes
Apr 20, 2026
nkolev92
approved these changes
Apr 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
working towards: NuGet/Home#14160
Description
I finally had time to update and fix #6670
Copied from that PR's description:
Legacy csproj has some quirks, because of Visual Studio APIs. We read items via IVsBuildItemStorage.FindItems, where it's necessary to pass it a list of item metadata that you're interested in. Therefore, at some point we need a complete list of metadata names per item type, which I added to LegacyProjectAdapter. In order to ensure this list is complete, I wrote a test that's rather long and seems complicated, but what it does is runs PackageSpecFactory.GetPackageSpec on a fake project adapter that ensures there's at least one item of every type (even types that we never expect in a non-SDK style project) and validates every metadata that PackageSpecFactory asks for is in the metadata names list. This way, if the metadata names dictionary is missing an item type, the test throws, or if the test didn't create at least one item of the type, the test throws, and finally if any of the item type metadata lists is missing a name, the test throws. This gives us confidence that the product code is not missing any metadata names.
PR Checklist
Link to an issue or pull request to update docs if this PR changes settings, environment variables, new feature, etc.N/A