Skip to content

Directory.Packages.props with more complex PackageReference does not execute regex replace #602

Open

Description

@dylbarne

When using (global) Central Package Management via Directory.Packages.props and the <GlobalPackageReference line in question is not a simple single line with self-closing tag /> (such as when specifying controlling assets use-case) the dotnet outdated -u command does correctly recognize the nugets to update, and runs through the process to completion, however does not actually update the Directory.Packages.props file contents.

Without digging to much into this codebase, I am assuming the issue is with Regex here perhaps


Edit: after playing around with the regex, seems a potentially temporary workaround is to put everything on the same line and mark end of line with comment of closing tag it is looking for, such as:

<GlobalPackageReference Include="coverlet.collector" Version="6.0.0"><PrivateAssets>all</PrivateAssets><IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets></GlobalPackageReference><!-- /> -->

then the update completes successfully, changing to latest version 6.0.2 properly

Activity

  1. jnormen commented on Mar 11, 2025

    @jnormen

    I have kind of the same problem.
    the tool says it has updated a library to latest version but no file have changed when using central package when there is a sourcegenerator lib that adds

    all runtime; build; native; contentfiles; analyzers; buildtransitive

    in the central file. If I remove this and run the tool it works. But if I update the libs in Rider or VS .Net it adds the line again and the update tool will not update the library even if it tells it does.

  2. timabell commented on Sep 18, 2026

    @timabell
    Contributor

    I have a fork that switched some of the code from regex to xdocument, feel free to give it a try, it might help - master...timabell:dotnet-outdated:main - it's a bit vibe-coded at the moment so not ready for a pr

  3. timabell commented on Nov 12, 2026

    @timabell
    Contributor

    looks like this issue can be closed now with #783 merged

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