Add packages lock file support for aliased projects with duplicate frameworks#7105
Open
Add packages lock file support for aliased projects with duplicate frameworks#7105
Conversation
9be14cc to
8822439
Compare
Contributor
|
I vote for the last one, since alias is just an alias for the target framework! 🤔 {
"version": 3,
"alias/rid": {
"framework": "net10.0",
"dependencies": {
"Newtonsoft.Json": {
"type": "Direct",
"requested": "[13.0.4, )",
"resolved": "13.0.4",
"contentHash": "pdgNNMai3zv51W5aq268sujXUyx7SNdE2bj1wZcWjAQrKMFZV260lbqYop1d2GM67JI1huLRwxo9ZqnfF/lC6A=="
}
}
}
} |
Member
Author
|
I've been having some internal discussions and that seems to be the consensus too :) |
zivkan
reviewed
Feb 19, 2026
src/NuGet.Core/NuGet.ProjectModel/ProjectLockFile/PackagesLockFileTarget.cs
Outdated
Show resolved
Hide resolved
src/NuGet.Core/NuGet.ProjectModel/ProjectLockFile/PackagesLockFileFormat.cs
Show resolved
Hide resolved
src/NuGet.Core/NuGet.ProjectModel/ProjectLockFile/PackagesLockFileTarget.cs
Show resolved
Hide resolved
src/NuGet.Core/NuGet.ProjectModel/ProjectLockFile/PackagesLockFileTarget.cs
Outdated
Show resolved
Hide resolved
src/NuGet.Core/NuGet.ProjectModel/ProjectLockFile/PackagesLockFileFormat.cs
Outdated
Show resolved
Hide resolved
src/NuGet.Core/NuGet.ProjectModel/ProjectLockFile/PackagesLockFileFormat.cs
Show resolved
Hide resolved
8f62de7 to
f95c2dc
Compare
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
Fixes: NuGet/Home#14538
Description
This PR adds support for a V3 formatted lock file.
Unlike the assets file, this file is checked in, so we should not cause the lock file to upgrade unless absolutely necessary.
As such the v3 format will only be enabled when there are duplicate frameworks.
The only real contentious piece here is the format of the new lock file.
The spec is at NuGet/Home#14760.
The current lock file has a dependencies element and
tfm/ridas a key.{ "version": 1, "dependencies": { "net10.0": { "Newtonsoft.Json": { "type": "Direct", "requested": "[13.0.4, )", "resolved": "13.0.4", "contentHash": "pdgNNMai3zv51W5aq268sujXUyx7SNdE2bj1wZcWjAQrKMFZV260lbqYop1d2GM67JI1huLRwxo9ZqnfF/lC6A==" } } } }The new variation is as below.
Note that the order of dependencies a alias/rid is actually being inverted to avoid adding redundant depth.
{ "version": 3, "alias/rid": { "framework": "net10.0", "dependencies": { "Newtonsoft.Json": { "type": "Direct", "requested": "[13.0.4, )", "resolved": "13.0.4", "contentHash": "pdgNNMai3zv51W5aq268sujXUyx7SNdE2bj1wZcWjAQrKMFZV260lbqYop1d2GM67JI1huLRwxo9ZqnfF/lC6A==" } } } }You can read about the alternatives in the PR at NuGet/Home#14760
PR Checklist