NuGet Error NU1011

Centrally defined floating package versions are not allowed.

Issue

By default, <PackageVersion /> items cannot contain floating versions. NuGet's central package management (CPM) is considered an enterprise-level feature which provides easier version management at scale as well as deterministic and secure restores. The use of floating versions introduces the possibility for a bad package to be introduced into your build after it has been pushed to a feed. This can lead to a situation where you made no changes in your repository but suddenly something is broken and there is no way for you to get back into a good state without removing the floating version or pushing a newer version of the package which is fixed. Using non-floating versions means that every upgrade to a package is backed by a commit in your repository making it easy to determine what change caused the break and to revert a commit to get back into a good state.

The Transitive Pinning feature is designed to allow you to explicitly override the transitive versions in your graph for more control. Using a floating version as an override could make restores of different projects end up with different versions for the package that is supposed to be pinned, thus going against the promise of using the central version.

NuGet recommends you use automation like Dependabot to keep package versions up-to-date which provides a streamlined way of keeping packages updated while integrating into your existing developer workflow of a pull request, automated build validation, and testing all backed by a commit in your repository.

Solution

It is recommended to change the floating version to a non floating version range. If that is not possible, you can enable floating versions with CPM by setting an MSBuild property:

<PropertyGroup>
  <CentralPackageFloatingVersionsEnabled>true</CentralPackageFloatingVersionsEnabled>
</PropertyGroup>