Vers 0.1.0

dotnet add package Vers --version 0.1.0
                    
NuGet\Install-Package Vers -Version 0.1.0
                    
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="Vers" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Vers" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Vers" />
                    
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 Vers --version 0.1.0
                    
#r "nuget: Vers, 0.1.0"
                    
#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 Vers@0.1.0
                    
#: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=Vers&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Vers&version=0.1.0
                    
Install as a Cake Tool

Vers.NET

A .NET Standard 2.0 library for the vers version range specification. Parses, validates, evaluates, and converts version ranges across package ecosystems.

Every package manager invented its own range syntax. npm uses ^1.2.3. Maven uses [1.0, 2.0). PyPI uses >=1.0,<2.0. RubyGems uses ~> 2.2. Vers is one notation that covers all of them: vers:npm/>=1.0.0|<3.0.0.

Quick start

var range = VersRange.Parse("vers:npm/>=1.0.0|<3.0.0");

range.Contains("2.5.0");   // true
range.Contains("3.0.0");   // false
range.Contains("0.9.0");   // false

Wildcards, exact versions, and disjoint ranges:

VersRange.Parse("vers:deb/*").Contains("anything");           // true
VersRange.Parse("vers:pypi/1.0|2.0|3.0").Contains("2.0");    // true
VersRange.Parse("vers:npm/>=1.0.0|<=1.5.0|>=3.0.0|<=4.0.0")
    .Contains("2.0.0");                                       // false (in the gap)

Converting native ranges

Convert ecosystem-specific range syntax to vers and back:

// npm's caret notation → vers
var range = NativeRangeConverterRegistry.FromNative("npm", "^1.2.3");
range.ToString(); // "vers:npm/>=1.2.3|<2.0.0"

// NuGet's interval notation → vers
var nuget = NativeRangeConverterRegistry.FromNative("nuget", "[1.0.0, 2.0.0)");
nuget.ToString(); // "vers:nuget/>=1.0.0|<2.0.0"

// RubyGems pessimistic constraint → vers
var gem = NativeRangeConverterRegistry.FromNative("gem", "~>2.0.8");
gem.ToString(); // "vers:gem/>=2.0.8|<2.1"

Built-in converters for npm (including ||, ~, ^, hyphen, wildcard), PyPI, NuGet, RubyGems, Conan, OpenSSL, and nginx.

Building ranges programmatically

var range = new VersRange.Builder("npm")
    .AddConstraint(Comparator.GreaterThanOrEqual, "1.0.0")
    .AddConstraint(Comparator.LessThan, "3.0.0")
    .Build();

range.ToString(); // "vers:npm/>=1.0.0|<3.0.0"

Supported versioning schemes

Comparers for every ecosystem in the vers spec:

Scheme Aliases Notes
semver npm, golang, cargo, composer SemVer 2.0.0 with pre-release
maven Full ComparableVersion algorithm
nuget Case-insensitive pre-release, 4-part versions
deb Debian Policy §5.6.12 (epochs, tilde sorting)
rpm rpmvercmp with epoch and tilde/caret
pypi PEP 440 (pre/post/dev releases, epochs, local)
gem RubyGems (string segments = pre-release)
gentoo ebuild, alpine, apk Gentoo vercmp (suffixes, letter, revision)
alpm arch Arch Linux (rpmvercmp-style with epoch + release)
conan Build metadata compared, unlike semver
openssl Legacy letter suffixes + modern semver
cpan Perl decimal and dotted-decimal formats
intdot nginx Dot-separated integers
generic Fallback for unknown schemes
lexicographic Bytewise UTF-8 comparison
datetime RFC 3339 timestamps
none Empty set (vers:none/* only)
all Universal set (vers:all/* only)

Unknown schemes fall back to the generic comparer.

Custom schemes

public class MyVersionComparer : IVersionComparer
{
    public int Compare(string v1, string v2) { /* ... */ }
    public string Normalize(string v) => v;
    public bool IsValid(string v) => true;
}

VersioningSchemeRegistry.Register(
    new VersioningScheme("myscheme", new MyVersionComparer()));

After registration, VersRange.Parse("vers:myscheme/>=1.0") uses your comparer.

Validation and simplification

var range = VersRange.Parse("vers:npm/>=1.0.0|<3.0.0");
range.Validate();   // throws VersException if invalid
range.Simplify();   // removes redundant constraints per the spec

What's not included

Invert(), Split(), Merge(), and OverlapsWith() from the Java/Python implementations. Pull requests welcome.

Conformance

Tests against the official vers-spec test data:

Run with dotnet test.

Install

Targets .NET Standard 2.0 (.NET Framework 4.6.1+, .NET Core 2.0+, .NET 5+). No external dependencies.

dotnet add package Vers

License

MIT

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0 45 2/23/2026