Skip to content

Floating versions resolve an unlisted version even when a listed version satisfies the range #15120

Open

Description

@thomhurst

NuGet Product Used

dotnet.exe

Product Version

.NET SDK 10.0.402 (NuGet 7.9.0-rc.611)

Worked before?

No. This follows the by-design decision in #10931.

Impact

It's more difficult to complete my work.

Repro Steps & Context

Package owners unlist a version to pull it: a broken release, an accidental publish, or a version with a security problem. Restore still picks that version for floating ranges, even when a listed version also satisfies the range, and it does so without a warning.

Live repro on nuget.org: Respire lists 0.11.0, and 1.0.116 has been unlisted for weeks (registration listed: false). Each case below ran with an empty HTTP cache and an empty global packages folder:

<PackageReference Include="Respire" Version="*" />    <!-- resolves 1.0.116 (unlisted), not 0.11.0 (listed) -->
<PackageReference Include="Respire" Version="1.*" />  <!-- resolves 1.0.116 (only unlisted versions match) -->
<PackageReference Include="Respire" Version="0.*" />  <!-- resolves 0.11.0 -->

dotnet restore succeeds with no warning in every case. By contrast, dotnet add package Respire with no version correctly picks 0.11.0 (#7466).

#10931 was closed by design: "we made a conscious decision to include them for floating packages to avoid breaking people who were relying on those packages already." That rationale covers the 1.* case, where nothing listed matches. It doesn't justify the * case, where restore skips a listed match in favor of a newer unlisted one. As a result, unlisting can't pull a bad release from anyone on a floating range, which is the main reason a publisher unlists.

Proposal

  1. For floating ranges, choose the best listed version that satisfies the range. Consider unlisted versions only when no listed version does. This keeps the back-compat behavior Restore installs unlisted packages when floating versions such as * are used #10931 protected while making unlisting effective for * / x.* consumers.
  2. Whenever restore resolves an unlisted version, emit a warning (for example, "resolved unlisted version X; the owner unlisted it"), so the case in (1) that still falls back is at least visible.

Related: #10931, #11989, #14215 (restore suggests unlisted versions as the nearest version).

Verbose Logs

No response

Activity

  1. dotnet-policy-service commented on Oct 26, 2026

    @dotnet-policy-service
    Contributor

    Issue is missing Type label, remember to add a Type label

  2. added
    missing-required-type
    on Oct 26, 2026
  3. added
    Type:DCR
    and removed
    missing-required-type
    on Oct 26, 2026
  4. added
    Priority:3
    on Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Functionality:RestorePriority:3Style:PackageReferenceType:DCR

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions