Repository navigation
Description
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
- 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. - 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
dotnet-policy-service commentedon Oct 26, 2026
Issue is missing Type label, remember to add a Type label