Skip to content

[Bug]: Floating version *-* resolves to the latest stable release instead of the latest prerelease #124

Closed

Description

@mna-intend

Description

In NuGet, the floating version * means "the latest stable release" and *-* means "the latest version including prereleases". Verso treats both the same way: *-* returns the latest stable release, and any newer prerelease is ignored.

Reproduced with a public package

System.CommandLine on nuget.org currently has:

latest stable      2.0.12
latest overall     3.0.0-rc.1.26425.128

A cell containing

#r "nuget: System.CommandLine, *-*"

resolves to 2.0.12. The Installed Packages list shows "System.CommandLine, 2.0.12", and the staging folder confirms it:

%TEMP%\verso-nuget-packages\net10.0-v2\System.CommandLine\2.0.12

Expected: 3.0.0-rc.1.26425.128.

Why this matters

It fails silently. There is no warning and no error - the notebook runs, the reference looks satisfied, and you only notice if you check which version actually got loaded. A notebook written to track prerelease builds quietly runs against an older stable one instead, which is exactly the opposite of what *-* was asked for.

That is the normal reason to write *-*: following the current prerelease of an internal CI feed, rather than editing a pinned version in every notebook on every build. The workaround is to pin each reference to an exact version, which removes the point of the floating range and means every notebook has to be touched whenever the version moves on.

Likely cause

It looks like the prerelease flag of the parsed range is not carried into the version selection. NuGet's VersionRange.Parse("-") produces a range whose IncludePrerelease is true; if the candidate list is filtered on IsPrerelease == false, or if the range is normalised to * before the candidates are filtered, the observed behaviour follows.

Worth checking at the same time whether other prerelease-bearing ranges are affected, for example [1.0.0-alpha,) or 1.0.0-*.

Steps to Reproduce

  1. Create a new .verso notebook.

  2. Add this cell and run it:

    #r "nuget: System.CommandLine, *-*"
    
    using System.IO;
    foreach (var d in Directory.GetDirectories(
            Path.Combine(Path.GetTempPath(), "verso-nuget-packages", "net10.0-v2", "System.CommandLine")))
        Console.WriteLine(Path.GetFileName(d));
    
  3. Observed output:

    2.0.12
    

    and Installed Packages shows "System.CommandLine, 2.0.12".

  4. Expected output:

    3.0.0-rc.1.26425.128
    

    which is the latest version of that package on nuget.org, as returned by
    https://api.nuget.org/v3-flatcontainer/system.commandline/index.json
    (latest stable there is 2.0.12, so * and *-* are currently
    indistinguishable in Verso).

Error Output

None. This is the problem: the wrong version is selected silently, with no
warning and no error.

Component

NuGet Package Resolution

Frontend

VS Code

Verso Version

1.2.2

.NET Version

10.0.301

Operating System

Windows 11

Notebook Snippet

#r "nuget: System.CommandLine, *-*"

using System.IO;
foreach (var d in Directory.GetDirectories(
        Path.Combine(Path.GetTempPath(), "verso-nuget-packages", "net10.0-v2", "System.CommandLine")))
    Console.WriteLine(Path.GetFileName(d));

// observed: 2.0.12
// expected: 3.0.0-rc.1.26425.128

Loaded Extensions

none

Severity

Medium - workaround exists but it's disruptive

Checklist

  • I searched existing issues and this hasn't been reported yet
  • I can reproduce this with no third-party extensions loaded

Activity

  1. added
    bug
    on Oct 7, 2026
  2. mna-intend commented on Oct 7, 2026

    @mna-intend
    Author

    A note on the same code path: Verso already ships NuGet.Versioning 6.9.1 (it is listed in host/Verso.Host.deps.json), so the full range syntax can come from the library instead of being special-cased:

    var range = VersionRange.Parse(spec);
    var best  = range.FindBestMatch(availableVersions);   // honours range.IncludePrerelease
    

    VersionRange.Parse already understands "" and "-*" with the correct IncludePrerelease flag, which is the bug reported above, and it covers the interval notations from
    https://learn.microsoft.com/nuget/concepts/package-versioning#version-ranges in the same step:

    [1.0.0,2.0.0)    >= 1.0.0 and < 2.0.0
    [1.0.0,2.0.0]    >= 1.0.0 and <= 2.0.0
    (1.0.0,)         > 1.0.0
    (,1.5.0]         <= 1.5.0
    

    Resolving through the library would make Verso behave the same way as dotnet restore and MSBuild PackageReference for every notation at once, rather than matching them one by one.

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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions