HLabs.ImageReferences 1.0.0-preview.3

This is a prerelease version of HLabs.ImageReferences.
dotnet add package HLabs.ImageReferences --version 1.0.0-preview.3
                    
NuGet\Install-Package HLabs.ImageReferences -Version 1.0.0-preview.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="HLabs.ImageReferences" Version="1.0.0-preview.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="HLabs.ImageReferences" Version="1.0.0-preview.3" />
                    
Directory.Packages.props
<PackageReference Include="HLabs.ImageReferences" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add HLabs.ImageReferences --version 1.0.0-preview.3
                    
#r "nuget: HLabs.ImageReferences, 1.0.0-preview.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package HLabs.ImageReferences@1.0.0-preview.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=HLabs.ImageReferences&version=1.0.0-preview.3&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=HLabs.ImageReferences&version=1.0.0-preview.3&prerelease
                    
Install as a Cake Tool

HLabs.ImageReferences 🐋

Strongly-typed container image references for .NET.

dotnet add package HLabs.ImageReferences

Getting Started

var partial = "nginx".Image(); // nginx

var qualified = partial.Qualified(); // docker.io/library/nginx:latest

var canonical = partial.Canonical("57e903..."); // docker.io/library/nginx@sha256:57e903...

Parsing references

var image = "ghcr.io/myorg/myapp:3.1.0".Image();

Registry   reg  = image.Registry; // ghcr.io
Namespace  ns   = image.Namespace; // myorg
Repository repo = image.Repository; // myapp
Tag        tag  = image.Tag; // 3.1.0

Modifying references

var dev = new ImageReference( "myapp", Tag.Latest, Registry.Localhost ); // localhost:5000/myapp:latest
var prod = dev.With( Registry.DockerHub, "myorg" ); // docker.io/myorg/myapp:latest
var pinned = prod.With( new SemVersion(2, 1, 0)); // docker.io/myorg/myapp:2.1.0
var withDigest = pinned.With( "sha256:a3ed95caeb02..." ); // docker.io/myorg/myapp@sha256:a3ed95caeb02...

Built-in registries and tags

Registry.DockerHub // docker.io
Registry.GitHub // ghcr.io
Registry.Quay // quay.io
Registry.Localhost // localhost:5000
Registry.Acr("mycompany") // mycompany.azurecr.io
Registry.Ecr("1234", "eu-west-1") // 1234.dkr.ecr.eu-west-1.amazonaws.com

Tag.Latest // latest

Extending with custom tags

Define your own well-known tags (or registries, repositories, etc.) using C# 14 extensions:

static class MyExtensions 
{
    extension(Tag) 
    {
        static Tag Dev => new("dev");
        static Tag Alpha(uint n) => new($"alpha-{n}"); 
    }
    
    extension(Registry) 
    {
        static Registry Internal => Registry.Ecr("1234", "eu-west-1")
    }
}

Then use them naturally:

var image = "myapp".Image( Tag.Dev, Registry.Localhost); // localhost:5000/myapp:dev
var alpha = image.With( Registry.Internal, Tag.Alpha(3) ); // 1234.dkr.ecr.eu-west-1.amazonaws.com/myapp:alpha-3
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on HLabs.ImageReferences:

Package Downloads
HLabs.ImageReferences.Extensions.Nuke

NUKE extensions for HLabs.ImageReferences

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-preview.3 69 2/17/2026
1.0.0-preview.2 50 2/17/2026
1.0.0-preview.1 52 2/16/2026