Blimmo.SemanticVersion
2.0.0
dotnet add package Blimmo.SemanticVersion --version 2.0.0
NuGet\Install-Package Blimmo.SemanticVersion -Version 2.0.0
<PackageReference Include="Blimmo.SemanticVersion" Version="2.0.0" />
<PackageVersion Include="Blimmo.SemanticVersion" Version="2.0.0" />
<PackageReference Include="Blimmo.SemanticVersion" />
paket add Blimmo.SemanticVersion --version 2.0.0
#r "nuget: Blimmo.SemanticVersion, 2.0.0"
#:package Blimmo.SemanticVersion@2.0.0
#addin nuget:?package=Blimmo.SemanticVersion&version=2.0.0
#tool nuget:?package=Blimmo.SemanticVersion&version=2.0.0
Blimmo.SemanticVersion
A semantic versioning parser and formatter for .NET that provides robust support for parsing, manipulating, and formatting semantic version strings according to the Semantic Versioning 2.0.0 specification.
Features
- ✅ Full SemVer 2.0.0 specification support
- ✅ Parse semantic version strings (e.g.,
1.2.3,1.0.0-alpha+build.123) - ✅ Support for major, minor, patch, prerelease, and build metadata
- ✅ Custom format strings for flexible version display
- ✅ Strong typing and null safety with nullable reference types
- ✅ Multi-target support: .NET 8, .NET 9, .NET 10
Installation
Install via NuGet Package Manager:
dotnet add package Blimmo.SemanticVersion
Or via Package Manager Console:
Install-Package Blimmo.SemanticVersion
Quick Start
Parsing Versions
using Blimmo.SemanticVersion;
// Parse a semantic version
var version = SemVer.Parse("1.2.3-alpha+build.42");
// Access version components
Console.WriteLine($"Major: {version.Major}"); // 1
Console.WriteLine($"Minor: {version.Minor}"); // 2
Console.WriteLine($"Patch: {version.Patch}"); // 3
Console.WriteLine($"Prerelease: {version.Prerelease}"); // alpha
Console.WriteLine($"Build: {version.Build}"); // build.42
Try Parse
if (SemVerParser.Default.TryParse("1.0.0-beta", out var semVer))
{
Console.WriteLine($"Successfully parsed: {semVer}");
}
Creating Versions
// Create a new semantic version
var version = new SemVer(1, 2, 3, "alpha", "build.123");
// Create without prerelease or build metadata
var simpleVersion = new SemVer(2, 0, 0);
Formatting Versions
var version = new SemVer(1, 2, 3, "alpha", "build");
// Format using custom format strings
version.TryFormat("VF", out var fullVersion); // 1.2.3-alpha+build
version.TryFormat("p", out var patchOnly); // 3
version.TryFormat("s", out var statusOnly); // alpha
Version Format
Semantic versions follow this format:
MAJOR.MINOR.PATCH[-PRERELEASE][+BUILD]
- MAJOR: Incremented for incompatible API changes
- MINOR: Incremented for backwards-compatible functionality additions
- PATCH: Incremented for backwards-compatible bug fixes
- PRERELEASE (optional): Indicates pre-release version (e.g., alpha, beta, rc.1)
- BUILD (optional): Build metadata (e.g., build.123, commit.abc123)
Examples
// Valid semantic versions
1.0.0
1.2.3
1.0.0-alpha
1.0.0-beta.1
1.0.0-rc.1+build.123
2.1.3-preview.2+sha.abc123
License
This project is licensed under the MIT License.
Contributing
Contributions are welcome! Please feel free to submit issues or pull requests to the GitHub repository.
Repository
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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 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 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. |
-
net10.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.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 |
|---|
Second release of Blimmo.SemanticVersion, a semantic versioning library for .NET.
Changes in this release include:
- Changed format specifiers for formatting versions to be more intuitive. Specifically:
- F => Major.Minor.Patch[-Prerelease][+Build]
- VVVV => Major.Minor[-Prerelease]
- VVV => Major[.Minor][-Prerelease]
- VV => Major.Minor
- M[n] => Major (padded with n zeroes)
- m[n] => Minor (padded with n zeroes)
- mo[n] => [Minor] (padded with n zeroes)
- md[n] => [.] (. if Minor is present, otherwise empty)
- p[n] => Patch (padded with n zeroes)
- po[n] => [Patch] (padded with n zeroes)
- pd => [.] (. if Patch is present, otherwise empty)
- pr => [Prerelease]
- prh => [-] (- if Prerelease is present, otherwise empty)
- b => [Build]
- bp => [+] (+ if Build is present, otherwise empty)