Skip to content

NU1102's message refers to the requested, not the resolved version #14279

Open
@Tim-Pohlmann

Description

@Tim-Pohlmann

NuGet Product Used

dotnet.exe

Product Version

9.0.300-preview.0.25177.5

Worked before?

No response

Impact

It's more difficult to complete my work

Repro Steps & Context

NU1102's error message refers to the requested, not the resolved version. This can be extremely misleading, because it can create logs like this:

error NU1102: Unable to find package MyPackage with version (>= 10.8.0.113526)
error NU1102:   - Found 29 version(s) in MySource [ Nearest version: 10.8.0.113526 ]

The problem here is that my csproj-file was requesting version 10.8.0.113526 but the packages.lock.json file was pinning it to 10.8.0.111573 (which is higher and thus eligible) but only 10.8.0.113526 was present in the package source. The error message was completely hiding the fact and send me on a multi-hour bug hunt.

I would expect to see a log similar to this instead:

error NU1102: Unable to find package MyPackage with version 10.8.0.111573
error NU1102:   - Found 29 version(s) in MySource [ Nearest version: 10.8.0.113526 ]

This would make the problem obvious and point me in the right direction.

Even better would be to mention both versions. Maybe like this:

error NU1102: Unable to find package MyPackage with version 10.8.0.111573 (requested version: 10.8.0.113526)
error NU1102:   - Found 29 version(s) in MySource [ Nearest version: 10.8.0.113526 ]

Verbose Logs

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions