tetri.net.SemanticVersioning 0.2.1

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

SemanticVersioning

NuGet Version NuGet Downloads License Github Build Status AppVeyor Build Status

A robust Semantic Versioning 2.0.0 implementation for .NET with full support for parsing, comparison, and version operations.

📦 Installation

Install via NuGet Package Manager:

dotnet add package tetri.net.SemanticVersioning

Or add directly to your .csproj:

<PackageReference Include="tetri.net.SemanticVersioning" Version="1.0.0" />

🚀 Quick Start

Creating versions

// From string
var version = new SemanticVersion("1.2.3-alpha.1+20240301");

// Using constructor
var version = new SemanticVersion(major: 1, minor: 2, patch: 3, prerelease: "alpha.1", build: "20240301");

Comparing versions

var v1 = new SemanticVersion("1.2.3");
var v2 = new SemanticVersion("1.3.0");

if (v1 < v2) 
{
    Console.WriteLine($"{v1} is less than {v2}");
}

Supported operations

// Equality
bool equal = v1 == v2; 

// Comparison
bool greater = v1 > v2;

// Comparison methods
int result = v1.CompareTo(v2);

✨ Features

✅ Strict SemVer 2.0.0 string parsing
✅ Full version comparison support
✅ Pre-release support (alpha, beta, rc)
✅ Build metadata support
✅ Overloaded operators (==, !=, <, >, ⇐, >=)
✅ Immutable and thread-safe
✅ JSON/XML serialization ready

📚 Advanced Examples

Pre-releases

var stable = new SemanticVersion("1.0.0");
var beta = new SemanticVersion("1.0.0-beta.2");

Console.WriteLine(stable > beta); // True - stable versions have precedence

Build metadata

var v1 = new SemanticVersion("1.0.0+build.1");
var v2 = new SemanticVersion("1.0.0+build.2");

Console.WriteLine(v1 == v2); // True - build metadata doesn't affect equality

🤝 Contributing

We welcome contributions! Please follow these steps:

  1. Fork the project
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.


Crafted with 🧠 by Tetri Mesquita

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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.

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.2.1 160 5/7/2025
0.2.0 210 4/17/2025
0.1.0 180 4/7/2025
0.0.3 170 4/7/2025
0.0.2 113 4/4/2025
0.0.1 113 4/4/2025