Skip to main content
net8.0.NETStandard2.0

Parse, build, and normalize Package URLs (purl) per ECMA-427. Handles strings like pkg:nuget/[email protected].

Published
Apr 15, 2026
6mo ago
Total Downloads
1.3M
1,325,279

Install

dotnet add package packageurl-dotnet --version 2.0.0-rc.4
ProductVersions
.NET
net8.0
.NET Standard
netstandard2.0

README

packageurl-dotnet

Build License NuGet

A .NET parser for Package URLs (ECMA-427). Handles strings like pkg:nuget/[email protected] -- parses them apart, builds them from components, gives you a canonical form back.

Targets .NET Standard 2.0, so it works anywhere from .NET Framework 4.6.1 through .NET 10+.

Install

dotnet add package packageurl-dotnet

Or in your project file:

<PackageReference Include="packageurl-dotnet" Version="2.0.0" />

Usage

Parse a PURL string:

var purl = new PackageURL("pkg:nuget/[email protected]");

Console.WriteLine(purl.Type);      // nuget
Console.WriteLine(purl.Name);      // Newtonsoft.Json
Console.WriteLine(purl.Version);   // 13.0.1

Build one from parts:

var purl = new PackageURL(
    type: "maven",
    @namespace: "org.apache.commons",
    name: "commons-lang3",
    version: "3.14.0",
    qualifiers: null,
    subpath: null);

Console.WriteLine(purl.ToString());
// pkg:maven/org.apache.commons/[email protected]

There's also a two-argument shorthand if you only need type and name:

var purl = new PackageURL("npm", "lodash");

Build from source

Requires .NET SDK 10+.

dotnet pack -c Release
dotnet test -c Release ./tests

Or open PackageUrl.slnx in Visual Studio 2022+ and run tests from Test Explorer.

License

MIT

Changes from Previous Version

No structural changes between v2.0.0-rc.3 and v2.0.0-rc.4.

Adoption Assessment

Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.

This version is marked prerelease. Validate its API and upgrade path before production use.Compatibility metadata lists 2 target frameworks; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.