Skip to content

Create PackageSpec type and helpers for project.json Migration - #6826

Merged
donnie-msft merged 5 commits into
devfrom
dev-donnie-msft-PackageSpecMigratorSquash
Oct 3, 2025
Merged

donnie-msft merged 5 commits into
devfrom
dev-donnie-msft-PackageSpecMigratorSquash

Conversation

@donnie-msft

@donnie-msft donnie-msft commented Oct 2, 2025 •

Copy link
Copy Markdown
Contributor

Bug

Fixes: https://github.com/NuGet/Client.Engineering/issues/3200
Fixes: https://github.com/NuGet/Client.Engineering/issues/3201

Description

Enables Visual Studio to migrate project.json projects without being directly tied to Restore via PackageSpec.

Creates a narrow PackageSpec type as a representation of a project.json migration candidate.
Copies relevant JSON parsing methods and other helper methods to read the 3 important properties:

  • Library Dependencies
  • Target Framework Dependencies
  • Runtime Graph

Validation

Unit tests added covering ProjectJsonMigrationCandidatePackageSpecReaderTests which are similar to and adapted from tests in NuGet.ProjectModel.Test.JsonPackageSpecReaderTests.

Manually migrated a project.json project:

image

Tried multiple TargetFrameworks in a project.json to ensure an error is shown:

  "frameworks": {
    "net472": {},
    "netstandard2.0": {}
  },
image image

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.

@donnie-msft
donnie-msft requested a review from a team as a code owner October 2, 2025 20:41
@donnie-msft
donnie-msft requested review from jeffkl and nkolev92 October 2, 2025 20:41
@donnie-msft
donnie-msft requested a review from nkolev92 October 2, 2025 21:55

@nkolev92 nkolev92 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question/consideration.

@donnie-msft
donnie-msft requested a review from nkolev92 October 3, 2025 03:34
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.

3 participants