Docs: NuGet Central Package Management
This is not a comprehensive guide, but should get you started.
I attempted to codify these steps here: UpgradeRepo-prototype
- Remove existing reference to the old CPV MSBuild SDK. Usually that's an
<SDK>
element in yourDirectory.Build.props
or.targets
file. You can also remove the SDK version fromglobal.json
if you specified it there. - Enable CPM in your repo. Easiest way is to set
ManagePackageVersionsCentrally
to true in yourDirectory.Build.props
file. See the docs above for details. - Rename
Packages.props
toDirectory.Packages.props
. - Fixup your
Directory.Packages.props
file. Search and replace<PackageReverence Update="
with<PackageVersion Include="
. Global package references are the same.
In many cases, that's it! It might be a good idea to compare builds before/after to ensure you get the same results.