-
Notifications
You must be signed in to change notification settings - Fork 1k
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
improve nuget package detection with SDK-managed packages #11127
Open
brettfo
wants to merge
20
commits into
main
Choose a base branch
from
dev/brettfo/nuget-sdk-package-detection
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,354
−66
Conversation
This file contains 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
brettfo
force-pushed
the
dev/brettfo/nuget-sdk-package-detection
branch
3 times, most recently
from
December 20, 2024 19:29
9521d2f
to
0095890
Compare
ryanbrandenburg
previously approved these changes
Dec 21, 2024
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.
Nice one, mostly just nitpicking.
nuget/helpers/lib/NuGetUpdater/DotNetPackageCorrelation.Test/EndToEndTests.cs
Show resolved
Hide resolved
nuget/helpers/lib/NuGetUpdater/DotNetPackageCorrelation/Model/PackageMapper.cs
Show resolved
Hide resolved
nuget/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/MockNuGetPackage.cs
Show resolved
Hide resolved
nuget/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/SdkProjectDiscovery.cs
Outdated
Show resolved
Hide resolved
nuget/helpers/lib/NuGetUpdater/NuGetUpdater.Core/EnsureDotNetPackageCorrelation.targets
Show resolved
Hide resolved
brettfo
force-pushed
the
dev/brettfo/nuget-sdk-package-detection
branch
4 times, most recently
from
January 8, 2025 19:44
3c4adc5
to
265c03d
Compare
ryanbrandenburg
previously approved these changes
Jan 8, 2025
brettfo
force-pushed
the
dev/brettfo/nuget-sdk-package-detection
branch
from
January 9, 2025 16:55
265c03d
to
9269f01
Compare
randhircs
previously approved these changes
Jan 9, 2025
brettfo
dismissed stale reviews from randhircs and ryanbrandenburg
via
January 9, 2025 17:32
92623d8
brettfo
force-pushed
the
dev/brettfo/nuget-sdk-package-detection
branch
from
January 9, 2025 17:32
9269f01
to
92623d8
Compare
randhircs
approved these changes
Jan 9, 2025
ryanbrandenburg
approved these changes
Jan 9, 2025
randhircs
force-pushed
the
dev/brettfo/nuget-sdk-package-detection
branch
from
January 9, 2025 17:39
92623d8
to
00d66f6
Compare
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.
This PR contains a temporary commit that redirects the smoke tests.
Consider the following example:
A repo contains a
global.json
file requiring the .NET SDK version8.0.303
. A project in that repo has a dependency onSystem.Text.Json/8.0.0
(either transitively or directly, it doesn't matter.)When we detect dependencies, we run a
restore
operation, but the SDK takes special steps. During that operation, it sees the reference toSystem.Text.Json
and realizes it has a newer copy, so it removes the reference.The end result is that we don't report
System.Text.Json
as a reference because:(Doing some manual checking, the version of
System.Text.Json
that the8.0.303
SDK is using as a replacement is8.0.4
. This is important for later.)If we then try to perform an update on
System.Text.Json/8.0.4
=>8.0.5
we'll fail because that dependency wasn't reported.This PR fixes that behavior.
When the special package is removed, we detect that then perform a lookup to see that the version of
System.Text.Json
that ships with the SDK8.0.303
just so happens to match exactly with the NuGet packageSystem.Text.Json/8.0.4
. We then re-insert that dependency back into our reporting, because that's the equivalent package.This way when we try to update
System.Text.Json
to version8.0.5
, we can correctly see that the dependency does exist as version8.0.4
so the update then to8.0.5
succeeds.This was accomplished by adding a submodule to the
dotnet/core
repo and parsing and correlating severalreleases.json
files with markdown files that list the relevant packages. The end result is a 3MB JSON file that contains all of the NuGet packages that shipped with a given runtime so we can map thatSystem.Text.Json.dll
was pulled out of the restore graph and it was replaced with one fromMicrosoft.NETCore.App.Ref/8.0.7
and that the corresponding version ofSystem.Text.Json
for that same runtime release was8.0.4
. This large mapping file is generated on build, so no manual steps need to be performed (and no huge file was added).