dotnet-pkg-age 0.4.0-pre

This is a prerelease version of dotnet-pkg-age.
dotnet tool install --global dotnet-pkg-age --version 0.4.0-pre
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local dotnet-pkg-age --version 0.4.0-pre
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=dotnet-pkg-age&version=0.4.0-pre&prerelease
                    
nuke :add-package dotnet-pkg-age --version 0.4.0-pre
                    

dotnet-pkg-age

Pulls metadata from nuget.org to determine how recently a package was published, mostly for compliance with public package cooldown rules.

  • Check one package or everything in a solution.
  • Package name, version, and publish date are automatically cached.
  • Bypass list enables hotfixes to avoid the minimum age check.

Install

dotnet tool install dotnet-pkg-age

Requires .NET SDK 8.0 or greater.

Examples

package - check a single package, version, and minimum age:

dotnet pkg-age package xunit 2.9.3 10

bulk - check all packages in a solution's packages.lock.json files:

dotnet pkg-age bulk 5 --lock-files

bulk - check all packages in a Directory.Packages.props file and output json:

dotnet pkg-age bulk 5 --props -f json

cache - clear the entire cache:

dotnet pkg-age cache --clear-all

The GitHub wiki has more examples and documentation.

Bypass list

Specific package versions can be excluded from the age check by adding them to .config/pkg-age-bypass.json at the repo root. This is intended for security hotfixes where a version must be adopted immediately regardless of age.

{
  "NuGet.Versioning@7.6.0": "critical fix, approved by management"
}

Use --ignore-bypass to override the bypass list and enforce the age check regardless.

Key Dependencies

  • System.CommandLine for CLI arg parsing
  • NuGet.Protocol & NuGet.Versioning for working with the NuGet API
  • Xunit for automated testing

Build integration

Add a Directory.Build.targets file at the repo root to fail the build when any package is too new:

<Project>
  <Target Name="CheckPackageAge" BeforeTargets="Build">
    <Exec Command="dotnet pkg-age bulk 10 --props"
          WorkingDirectory="$(MSBuildThisFileDirectory)"
          ConsoleToMSBuild="true"
          IgnoreExitCode="true">
      <Output TaskParameter="ExitCode" PropertyName="PkgAgeExitCode" />
      <Output TaskParameter="ConsoleOutput" PropertyName="PkgAgeOutput" />
    </Exec>
    <Error Condition="'$(PkgAgeExitCode)' != '0'" Text="$(PkgAgeOutput)" />
  </Target>
</Project>
  • WorkingDirectory="$(MSBuildThisFileDirectory)" ensures the bypass file and Directory.Packages.props are resolved relative to the repo root, not the project directory.
  • ConsoleToMSBuild="true" + IgnoreExitCode="true" + <Error> replace the default MSB3073 exit-code error with the actual pkg-age output so failing package names appear in the build summary.
  • To skip the check in CI, add AND '$(GITHUB_ACTIONS)' != 'true' to the target's Condition.
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
0.4.0-pre 39 5/19/2026
0.3.0-pre 54 5/18/2026
0.2.0-pre 48 5/15/2026
0.1.0-pre 44 5/15/2026