question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support NuGet Central Package Management

See original GitHub issue

For solutions using the new NuGet Central Packagement feature, trying the --upgrade option will cause dotnet-outdated to add the package versions to the csproj package references, rather than updating the package versions in Directory.Packages.props, and consequently break the build. A simplified example of how this manifests is shown below.

Updating the tool to support this NuGet feature would allow such projects to leverage the --upgrade option, rather than just needing to manually update using the console’s output as a guide on what to update.

Happy to help-out with getting this supported!

Before

Directory.Packages.Props

<Project>
  <ItemGroup>
    <PackageVersion Include="Newtonsoft.Json" Version="12.0.2" />
  </ItemGroup>
</Project>

Project.csproj

<Project Sdk="Microsoft.NET.Sdk">
  <ItemGroup>
    <PackageReference Include="Newtonsoft.Json" />
  </ItemGroup>
</Project>

After

Directory.Packages.Props

<Project>
  <ItemGroup>
    <PackageVersion Include="Newtonsoft.Json" Version="12.0.2" />
  </ItemGroup>
</Project>

Project.csproj

<Project Sdk="Microsoft.NET.Sdk">
  <ItemGroup>
    <PackageReference Include="Newtonsoft.Json">
      <Version>12.0.3</Version>
    <PackageReference>
  </ItemGroup>
</Project>

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:13
  • Comments:14 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
leonardochaiacommented, Mar 11, 2022

Hello all.

Just wanted to hop in and say that I’d really like this feature to be implemented and would be happy to help any way I can. I use central package management in all my projects, since it simplifies managing versions on >1 project solutions.

For dotnet-affected, we implemented a feature where we can detect which projects are affected by adding/deleting/updating a nuget package. I think that works great together with dotnet-outdated: you update all your packages, and then in CI or locally you only build/test/publish the projects that were changed/affected by the package changes.

I wanted to share our implementation for reading Directory.Packages.props, which uses MSBuild in order to do so. This supports conditions as well, which is quite nice to have (we use conditions in props files for multi framework targeting)

We also have tests where we create Directory.Packages.props files, see here Particularly, we ensure conditions are interpreted

This is the code we use for updating packages, I wouldn’t use that in production (its for testing only) but perhaps we can get some inspiration for dotnet-outdated.

Should we create a package to share this code between these two tools?

Regards, Leo.

4reactions
coderpatroscommented, Aug 23, 2020

@martincostello that would be a great addition. We would welcome this functionality.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Introducing Central Package Management - The NuGet Blog
Central Package Management. Dependency management is a core feature of NuGet. Managing dependencies for a single project can be easy.
Read more >
Centrally managing NuGet package versions
In addition only specific types of projects will be supported for Central Package Version Management. Refer to this to see the exclusions.
Read more >
NuGet Central Package Management Comes To JetBrains ...
CPM allows developers to manage NuGet dependencies in a .NET solution from a central location. This can simplify the upgrade process of ...
Read more >
Central Package Management for .NET Projects
It's a way of controlling versions of NuGet packages in a centralized location. This solution follows the modern pattern of using Directory.*.
Read more >
Simplify NuGet Package Versions in your application with ...
In this post we're going to walk through using Central Package Management to simplify how you manage versions of your NuGet dependencies.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found