Error Knowledge Base NuGet NU1011

NU1011: PackageVersion items cannot specify a floating version

With Central Package Management enabled, floating versions in PackageVersion are blocked unless explicitly enabled.

Fix it fast

Most likely: A PackageVersion item in Central Package Management uses a floating version such as 1.*, and NuGet blocks that by default for reproducible restores.

1. Confirm this is your error
error NU1011: The following PackageVersion items cannot specify a floating version: My.Package. For more information ... https://aka.ms/nu1011
2. Check the cause
grep -R -n "<PackageVersion" Directory.Packages.props *.props
dotnet restore -v normal
3. Apply the safe fix
# Replace the floating PackageVersion with an exact version in Directory.Packages.props.
# Example: change Version="1.*" to Version="1.2.3".
dotnet restore
dotnet build
4. Verify it works
dotnet restore
dotnet list package
Don't use unsafe shortcuts
  • Do not use floating versions in PackageVersion items unless the repo intentionally enables that CPM behavior.
  • Do not move versions back into each PackageReference unless you intentionally stop using Central Package Management.
  • Do not use broad floating ranges for CI builds that need reproducible dependency resolution.

What NuGet Is Rejecting

With Central Package Management enabled, floating versions in PackageVersion are blocked unless explicitly enabled.

Fix the command

Replace floating versions with explicit versions, which is the recommended fix, and if needed, explicitly enable floating versions for CPM per the NU1011 guidance, then restore with dotnet restore.

Validation

Re-run the failing command and confirm the original code/message is gone, and confirm expected artifacts or outputs exist (packages restored, build/publish succeeds).

Why the Command Was Rejected

Usually this comes down to a PackageVersion uses a floating version such as 1.* or * under CPM, or a shared Directory.Packages.props introduced floating versions unintentionally.

Re-run the Minimal Correct Command

dotnet restore succeeds with NU1011 gone.

Resolved versions remain stable across machines and agents.

Mechanism

CPM centralizes versions in Directory.Packages.props. NuGet enforces determinism by disallowing floating versions by default and emits NU1011.

Avoid Command and Config Drift

To prevent this, use dependency update automation instead of floating versions, and review Directory.Packages.props changes via PR and CI restore.

Docs and source code

NU1011 CPM floating version message

Message template for the CPM floating version rule. - GitHub

  <data name="Error_CentralPackageManagement_FloatingVersionsNotAllowed" xml:space="preserve">
    <value>The following PackageVersion items cannot specify a floating version: {0}. For more information on how to enable this functionality for projects using Central Package Management, visit https://aka.ms/nu1011</value>
    <comment>
      0 - The comma delimited list of package names that specified a floating version.
      Do not localize `PackageVersion`
  </comment>
  </data>

Need help or found a mistake? Contact RepoFlow support for questions.

Join our mailing list