Edit

NuGet Error NU1020

Scenario

The following PackageReference items cannot specify a floating version because package source cooldown is enabled: Contoso.Library.

Issue

A package reference uses a floating version, such as 1.2.*, and at least one applicable package source has a nonzero minPublishAgeHours setting. The package doesn't match a minPublishAgeExceptions pattern. If Package Source Mapping is enabled, only sources mapped to the package are considered for this check.

Starting with NuGet 8.0, available in .NET SDK 11.0.100 and Visual Studio 18.12, restore doesn't support selecting a floating version while applying a minimum package publish age. The error calls this setting "package source cooldown." Restore reports this error without checking publish dates, even if all available versions have reached the minimum age.

Solution

Replace the floating version with a non-floating version. For example, change:

<PackageReference Include="Contoso.Library" Version="1.2.*" />

To:

<PackageReference Include="Contoso.Library" Version="1.2.3" />

Use a version you've reviewed and selected according to your package update policy. For centrally managed packages, change the corresponding PackageVersion in Directory.Packages.props instead.

If your policy permits the package to bypass minimum-age checks, you can instead add its ID to the minPublishAgeExceptions section of nuget.config:

<minPublishAgeExceptions>
  <package pattern="Contoso.Library" />
</minPublishAgeExceptions>

An exception applies to all versions of the package on all sources. This section replaces inherited exceptions, so include any other exceptions you intend to retain. Alternatively, remove minPublishAgeHours or set it to 0 on the applicable sources, but doing so removes the delay for every package using those sources.

Important

Ordinary restore doesn't enforce package ages. A non-floating reference or an excepted floating reference can restore a version that hasn't reached the configured minimum age.