Skip to content

Prevent invalid PackageReference errors caused by package ID casing - #7693

Merged
donnie-msft merged 1 commit into
devfrom
dev-donnie-msft-dotnetInvalidPackageRef
Sep 11, 2026
Merged

donnie-msft merged 1 commit into
devfrom
dev-donnie-msft-dotnetInvalidPackageRef

Conversation

@donnie-msft

@donnie-msft donnie-msft commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Bug

Fixes: NuGet/Home#15079

Description

NuGet compares package IDs case-insensitive. However, one place assumed that casing in the assets file would match the casing in the PackageReference.

This makes the comparison always case-insensitive. Adds a test for the scenario.

Before this change

Error is shown. After this PR (right), the list succeeds for the same project.

Unable to read a package reference from the project C:\NuGet.Client-C\.test\PackageCasingRepro\PackageCasingRepro.csproj. Make sure that your project file and project.assets.json file are in sync by running restore.

image

After this change

List package works properly.

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 September 9, 2026 23:41
@donnie-msft
donnie-msft merged commit 3b98797 into dev Sep 11, 2026
17 of 18 checks passed
@donnie-msft
donnie-msft deleted the dev-donnie-msft-dotnetInvalidPackageRef branch September 11, 2026 23:20
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.

"Unable to read a package reference from the project" from dotnet list after dotnet package add

4 participants