Skip to content

Version ranges are not preserved when upgrading packages #388

Closed

Description

@acatuttle

STEPS TO REPRODUCE

  1. Create a new project with a reference to a package that
    a. has a minor or patch upgrade
    b. specifies a version range, e.g.
    <PackageReference Include="Microsoft.AspNetCore.Authentication.Negotiate" Version="[6.0.13,7)" />
  2. Run the upgrade command, e.g. dotnet-outdated --version-lock Major --upgrade

EXPECTED RESULT

The specified version range is preserved, i.e. the resulting reference should be
<PackageReference Include="Microsoft.AspNetCore.Authentication.Negotiate" Version="[6.0.14,7)" />

ACTUAL RESULT

Version ranges are removed, i.e. the resulting reference is
<PackageReference Include="Microsoft.AspNetCore.Authentication.Negotiate" Version="6.0.14" />

Activity

  1. acatuttle commented on Feb 22, 2023

    @acatuttle
    Author

    Preferrably, version ranges would also be respected. This would effectively remove the need for the --version-lock switch and solve issues like #106 ? But that probably requires a lot more work.

  2. jeroensmink98 commented on Mar 27, 2023

    @jeroensmink98

    I'm also experiencing this but only if I run dotnet outdated in my Azure Pipeline

    Local expected output:

    [net6.0]
     Our.Umbraco.Community.Contentment  4.4.1  -> 4.4.2
     Our.Umbraco.ConditionalDisplayers  3.2.1  -> 3.2.4
     Umbraco.Cms                        10.4.0 -> 10.4.2
    

    Acutal output of the CI Job:

    [net6.0]
    Umbraco.Cms  11.0.0 ->  
    

    This happens with both variants of running dotnet outdated

    - task: PowerShell@2
              displayName: Run Dotnet outdated
              inputs:
                targetType: "inline"
                script: |
                  dotnet outdated -inc Umbraco. -vl Major -u
    
            - task: DotNetCoreCLI@2
              displayName: "Update Umbraco CMS"
              inputs:
                command: "custom"
                custom: "outdated"
                arguments: "-inc Umbraco. --version-lock Major -u"

    The version lock does not seem to work. But its pretty weird since on my local installation I use the exact same version of the tool as in my pipeline runner

  3. spaasis commented on Feb 21, 2024

    @spaasis

    Same here. Is there any workaround?

    EDIT: some pertinent information:

    .csproj: <PackageReference Include="IronPython" Version="2.*"/>

    Output during the CI run:
    IronPython 2.7.12 -> 3.4.1

    The result of the updated .csproj: <PackageReference Include="IronPython" Version="3.4.1" />

  4. danm-de commented on Apr 15, 2025

    @danm-de

    I've been hoping for a solution to this problem for a long time. The current behavior (both of Visual Studio's NuGet Solution Update and the command-line tools) causes many errors in automated update processes.

  5. v1nz3 commented on Jun 15, 2026

    @v1nz3

    Just wanted to follow up on this - PR #702 looks like it would fix this issue by preserving version ranges during upgrades, which would be really useful.
    I noticed it currently has merge conflicts, so it probably needs a bit of attention to get it ready to merge. @GREsau, would you be able to rebase it when you have some time?
    Thanks for maintaining this project!

  6. iamr8 commented on Sep 25, 2026

    @iamr8

    Still reproduces on 4.8.1: Version="[12.0.1,14.0.0)" becomes Version="13.0.4" after dotnet outdated R.csproj -u -inc Newtonsoft.Json. This also affects dotnet outdated GUI (#770), which runs -u. +1 for PR #702.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions