NuGet.Client icon indicating copy to clipboard operation
NuGet.Client copied to clipboard

Raise error when PackageReference has no version

Open zivkan opened this issue 9 months ago • 3 comments

Bug

Fixes: https://github.com/NuGet/Home/issues/13796

Description

Add validation before resolving the package graph, that PackageReference items have the version specified. Only applies for SdkAnalysisLevel 10.0.100 and above, otherwise the NU1604 "no lower bound" warning is generated as before.

I also changed the SDK Analysis Level helper, because as more features gate on different versions, each feature having its own field/property will become very long, and the existing implementation had multiple duplicate version objects. This PR changes the helper to have a field that represents the version, and references to the feature names are changed to their corresponding versions.

PR Checklist

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

zivkan avatar Mar 29 '25 01:03 zivkan

The changes look good to me:

We probably need to follow: https://github.com/NuGet/NuGet.Client/pull/6341.

cc @aortiz-msft

nkolev92 avatar Mar 31 '25 19:03 nkolev92

Is this an opt-in or opt-out behaviour?

RussKie avatar Apr 08 '25 23:04 RussKie

Removing my assignment from a Draft pull request.

donnie-msft avatar Apr 30 '25 21:04 donnie-msft

I lost my test in a bad rebase 😭

zivkan avatar May 23 '25 22:05 zivkan

dotnet/docs issue about the SDK breaking change:

  • https://github.com/dotnet/docs/issues/46386

zivkan avatar May 24 '25 02:05 zivkan