Skip to main content
Version: 4.0 (next)

Install Humanizer

Orientation

Install the Humanizer package in the project that produces user-facing text. Select the documentation version that matches the package version in your application before copying commands or API links.

Example

Install Humanizer 4 from NuGet:

dotnet add package Humanizer --version 4.0.0

Then add using Humanizer; and run this verified program:

Program.cs
using System.Globalization;
using Humanizer;

CultureInfo.CurrentCulture = CultureInfo.GetCultureInfo("en-US");
CultureInfo.CurrentUICulture = CultureInfo.GetCultureInfo("en-US");

var result = TimeSpan.FromMinutes(2).Humanize();
if (result != "2 minutes")
throw new InvalidOperationException($"Unexpected result: {result}");

Console.WriteLine(result);

The project must target a framework supported by the selected package. Humanizer 4 ships net11.0, net10.0, net8.0, net48, and netstandard2.0 assets.

Confirm the reference

Run:

dotnet list package

The project should list Humanizer at the version you selected. In centrally managed repositories, put the version in Directory.Packages.props and omit --version from the project command.

Pitfall

Do not assume that every framework capable of consuming netstandard2.0 is supported. For the current release line, .NET Framework support is explicitly .NET Framework 4.8.

Version notes

Humanizer 4 is consolidated into the Humanizer package. Releases through 3.0.10 use a metapackage over Humanizer.Core and locale packages. See package selection before replacing package references during an upgrade.