JsonApiDotNetCore icon indicating copy to clipboard operation
JsonApiDotNetCore copied to clipboard

Use Centrally managed NuGet package versions

Open bart-degreed opened this issue 5 years ago • 3 comments

We currently store the version of dependent NuGet packages centrally in Directory.Build.props using placeholder variables. This works, but when updating a package reference, the placeholder gets replaced with a hardcoded version. This requires a manual correction step.

A better solution is to instead use Directory.Packages.props, which works by leaving out the version from the package references in project files.

bart-degreed avatar Oct 24 '20 10:10 bart-degreed

Update: this is available in .NET 7 Preview 4: https://docs.microsoft.com/nl-nl/nuget/consume-packages/Central-Package-Management.

bkoelman avatar May 12 '22 09:05 bkoelman

Well, this is still in preview. And not at all working very well. https://github.com/NuGet/Home/issues?q=is%3Aissue+is%3Aopen+central+package+management

bkoelman avatar Oct 02 '22 19:10 bkoelman

Gave it another try, but we still can't use it because floating versions are blocked.

What could have been a pretty simple project (store versions globally) has become quite a nightmare. It handles transitive dependencies very differently, which makes floating versions hard to tackle and multiple package sources are problematic. To workaround this limitation, some people use version ranges instead, which come with their own issues. And the officially documented workarounds for them just don't work in combination with central package management. Users report all kinds of weird warnings/errors that shouldn't pop up. It seems that CPM is targeted at large enterprises that don't trust their developers and want to lock down everything.

List of active issues at https://github.com/NuGet/Home/labels/Area%3ARestoreCPM.

bkoelman avatar Sep 27 '23 23:09 bkoelman