Table of Contents

FromVersion Method

Definition

Namespace
Codebelt.Extensions.Asp.Versioning
Assemblies
Codebelt.Extensions.Asp.Versioning.dll
Source
src/Codebelt.Extensions.Asp.Versioning/SemanticApiVersion.cs

FromVersion(Version, Action<VersionConversionOptions>)

Creates a new instance of the SemanticApiVersion class from a Version object.

public static SemanticApiVersion FromVersion(Version version, Action<VersionConversionOptions> setup = null)

Parameters

version Version

The Version to convert to a semantic API version.

setup Action<VersionConversionOptions>

The VersionConversionOptions that may be configured.

Returns

SemanticApiVersion

A new SemanticApiVersion instance derived from the specified version.

Remarks

The conversion follows these rules:

  • The Major component maps to the major version.
  • The Minor component maps to the minor version.
  • The Build component maps to the patch version; if negative, it defaults to zero.
  • The Revision component may be included in build metadata if configured via IncludeRevision.

Exceptions

ArgumentNullException

version is null.

ArgumentException

setup failed to configure an instance of VersionConversionOptions in a valid state.