SemanticVersionExtensions Class

Provides extension methods for SemanticVersion.

public static class SemanticVersionExtensions

Methods

NameDescription
NextMajorVersion(SemanticVersion)Gets the next major version: the smallest stable version that is greater than this version and whose minor and patch numbers are zero. For a prerelease of a major version (e.g., 2.0.0-beta), returns that major version (2.0.0). Otherwise, increments the major number and resets the minor and patch numbers to zero (1.2.3-beta gives 2.0.0).
NextMinorVersion(SemanticVersion)Gets the next minor version: the smallest stable version that is greater than this version and whose patch number is zero. For a prerelease of a minor version (e.g., 1.2.0-beta), returns that minor version (1.2.0). Otherwise, increments the minor number and resets the patch number to zero (1.2.3-beta gives 1.3.0).
NextPatchVersion(SemanticVersion)Gets the next patch version. For prerelease versions, returns the version without the prerelease tag. For stable versions, increments the patch number.

NextMajorVersion(SemanticVersion)

SemanticVersionExtensions.cs

Gets the next major version: the smallest stable version that is greater than this version and whose minor and patch numbers are zero. For a prerelease of a major version (e.g., 2.0.0-beta), returns that major version (2.0.0). Otherwise, increments the major number and resets the minor and patch numbers to zero (1.2.3-beta gives 2.0.0).

public static SemanticVersion NextMajorVersion(this SemanticVersion semanticVersion)

Parameters

semanticVersion SemanticVersion

Returns

SemanticVersion

Exceptions

OverflowException
The major number is Int32.MaxValue and has to be incremented.

NextMinorVersion(SemanticVersion)

SemanticVersionExtensions.cs

Gets the next minor version: the smallest stable version that is greater than this version and whose patch number is zero. For a prerelease of a minor version (e.g., 1.2.0-beta), returns that minor version (1.2.0). Otherwise, increments the minor number and resets the patch number to zero (1.2.3-beta gives 1.3.0).

public static SemanticVersion NextMinorVersion(this SemanticVersion semanticVersion)

Parameters

semanticVersion SemanticVersion

Returns

SemanticVersion

Exceptions

OverflowException
The minor number is Int32.MaxValue and has to be incremented.

NextPatchVersion(SemanticVersion)

SemanticVersionExtensions.cs

Gets the next patch version. For prerelease versions, returns the version without the prerelease tag. For stable versions, increments the patch number.

public static SemanticVersion NextPatchVersion(this SemanticVersion semanticVersion)

Parameters

semanticVersion SemanticVersion

Returns

SemanticVersion

Exceptions

OverflowException
The patch number is Int32.MaxValue.