Skip to content

Comments

Add packages lock file support for aliased projects with duplicate frameworks#7105

Open
nkolev92 wants to merge 7 commits intodevfrom
dev-nkolev92-aliasedLockFile
Open

Add packages lock file support for aliased projects with duplicate frameworks#7105
nkolev92 wants to merge 7 commits intodevfrom
dev-nkolev92-aliasedLockFile

Conversation

@nkolev92
Copy link
Member

@nkolev92 nkolev92 commented Feb 5, 2026

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/rid as 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

  • Meaningful title, helpful description and a linked NuGet/Home issue
  • Added tests
  • Link to an issue or pull request to update docs if this PR changes settings, environment variables, new feature, etc.

@nkolev92 nkolev92 force-pushed the dev-nkolev92-aliasedLockFile branch 2 times, most recently from 9be14cc to 8822439 Compare February 10, 2026 23:11
@Nirmal4G
Copy link
Contributor

Nirmal4G commented Feb 12, 2026

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=="
      }
    }
  }
}

@nkolev92
Copy link
Member Author

I've been having some internal discussions and that seems to be the consensus too :)

@nkolev92 nkolev92 marked this pull request as ready for review February 13, 2026 00:45
@nkolev92 nkolev92 requested a review from a team as a code owner February 13, 2026 00:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ensure PackagesLockFile supports aliases

5 participants