FromVersion Method
Definition
- Namespace
- Codebelt.Extensions.Asp.Versioning
- Assemblies
- Codebelt.Extensions.Asp.Versioning.dll
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
versionVersionThe Version to convert to a semantic API version.
setupAction<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
versionisnull.- ArgumentException
setupfailed to configure an instance of VersionConversionOptions in a valid state.