Summary
Represents a semantic version with optional pre-release tag and build metadata.
- Assembly
- GitVersion
.Core .dll - Namespace
- GitVersion
- Interfaces
-
- IFormattable
- IComparable
<SemanticVersion> - IEquatable
<SemanticVersion>
- Base Types
-
- Object
graph BT
Type-->Base0["Object"]
Type-.->Interface0["IFormattable"]
Type-.->Interface1["IComparable<SemanticVersion>"]
Type-.->Interface2["IEquatable<SemanticVersion>"]
Type["SemanticVersion"]
class Type type-node
Syntax
public sealed class SemanticVersion : IFormattable, IComparable<SemanticVersion>,
IEquatable<SemanticVersion>
Attributes
| Type | Description |
|---|---|
| Nullable |
|
| NullableAttribute |
Constructors
| Name | Summary |
|---|---|
| SemanticVersion | Initializes a new semantic version with the given major, minor, and patch values. |
| SemanticVersion | Initializes a new semantic version as a copy of semanticVersion. |
Fields
| Name | Constant Value | Summary |
|---|---|---|
| Empty |
A zero-valued semantic version with no pre-release tag or build metadata.
static
|
Properties
| Name | Value | Summary |
|---|---|---|
| IsPreRelease | bool |
Gets a value indicating whether this version has a pre-release tag.
|
Methods
| Name | Value | Summary |
|---|---|---|
| CompareTo |
int |
Compares this version to value, optionally excluding the pre-release tag from the comparison.
|
| CompareTo |
int |
Compares this version to value, including the pre-release tag in the comparison.
|
| Equals |
bool | |
| Equals |
bool |
Returns
true when this version is equal to obj. |
| get_BuildMetaData |
Semantic |
|
| get_Major |
long | |
| get_Minor |
long | |
| get_Patch |
long | |
| get_PreReleaseTag |
Semantic |
|
| GetHashCode |
int |
Returns a hash code combining all version components.
|
| Increment |
SemanticVersion |
Returns a new version incremented by increment with the given label, optionally forcing the increment.
|
| Increment |
SemanticVersion |
Returns a new version incremented by increment with the given label and increment mode.
|
| Increment |
SemanticVersion |
Returns a new version incremented by increment with the given label.
|
| IsEmpty |
bool |
Returns
true when this instance equals Empty. |
| IsEqualTo |
bool |
Returns
true when this version is equal to value. |
| IsGreaterThan |
bool |
Returns
true when this version is greater than value. |
| Is |
bool |
Returns
true when this version is greater than or equal to value. |
| IsLabeledWith |
bool |
Returns
true when the pre-release tag name equals value (case-insensitive). |
| IsLessThan |
bool |
Returns
true when this version is less than value. |
| IsLessThanOrEqualTo |
bool |
Returns
true when this version is less than or equal to value. |
| Is |
bool |
Returns
true when this version is compatible with a branch-specific label check: no tag set, no label supplied, or the label matches. |
| Parse |
SemanticVersion |
Parses version as a semantic version, throwing when the input cannot be parsed.
static
|
| set_BuildMetaData |
||
| set_Major |
||
| set_Minor |
||
| set_Patch |
||
| set_PreReleaseTag |
||
| ToString |
string |
Returns the default semantic version string (without build metadata).
|
| ToString |
string |
s - Default SemVer [1.2.3-beta.4] f - Full SemVer [1.2.3-beta.4+5] i - Informational SemVer [1.2.3-beta.4+5.Branch.main.BranchType.main.Sha.000000] j - Just the SemVer part [1.2.3] t - SemVer with the tag [1.2.3-beta.4] |
| ToString |
string |
Returns a string representation of this version using the given format specifier.
|
| TryParse |
bool |
Attempts to parse version as a semantic version, returning
true on success.static
|
| WithLabel |
SemanticVersion |
Returns a new version derived from this one with the pre-release tag changed to label.
|
Operators
| Name | Value | Summary |
|---|---|---|
| operator != |
bool | |
| operator |
bool | |
| operator |
bool | |
| operator == |
bool | |
| operator > |
bool | |
| operator > |
bool |
Extension Methods
| Name | Value | Summary |
|---|---|---|
| Get |
string |
Returns the
AssemblyFileVersionAttribute value for the given scheme, or null when the scheme is None. |
| GetAssemblyVersion |
string | |
| NotNull |
T |
Throws
System.ArgumentNullException when value is null; otherwise returns the value.From CommonExtensions
|