The build system thinks that your solution has Central Package Management (CPM) enabled while your package references are not configured to support said setup.
If you did not change anything in your setup, something must be setting ManagePackageVersionsCentrally
configuration property to True
for you outside of your project files. The most probable culprit is Directory.Packages.props but it could be other files like Directory.Build.props or Directory.Build.targets.
Note that these files are searched recursively in parent directories from the project that is being built (documentation).
The property might even be set as an environment variable on your system.
It’s also possible that some package pulls such configuration, albeit that should not be the case if you did not change anything in the projects/references.
Note also that the tooling that supports CPM was released in May 2022 so it’s quite probable that some of the tooling you use got updated as this feature did not exist 3 years ago. You wouldn’t be getting this error from pre-CPM tooling. dotnet
gets updated as part of Windows Update automatically – I’m quite confident that if you used dotnet --version
, you’d see a newer version than that of ~3 years ago.
That being said, these are only pointers where to look, any exact solution would be specific to your case and not a general answer. If neither of these pointers help, you’ll probably have to check the diagnostic logs of dotnet restore
or whatever command triggers the error for you.
You might want to start with printing out the value of ManagePackageVersionsCentrally
variable during build to ensure this answer is not totally off, though. See How to output a variable value to the log from MSBuild.