Table of Contents

Class VersionOutputs

Namespace
NoeticTools.Git2SemVer.Framework.Generation
Assembly
NoeticTools.Git2SemVer.Framework.dll
public sealed class VersionOutputs : IVersionOutputs
Inheritance
VersionOutputs
Implements
Inherited Members

Constructors

VersionOutputs()

[JsonConstructor]
public VersionOutputs()

VersionOutputs(GitOutputs)

public VersionOutputs(GitOutputs gitOutputs)

Parameters

gitOutputs GitOutputs

Properties

AssemblyVersion

The Microsoft assembly version.

public Version? AssemblyVersion { get; set; }

Property Value

Version

Remarks

This value will be written to the MSBuild AssemblyVersion property.

To conform to common usage Git2SemVer's default approach is to make this appear as a three part Semantic Version.

This a Microsoft four part version with the format <major>.<minor>[.<build>[.<revision>]]. It is not a semantic version (notice that the build number is the third part).

See System.Version .

BuildContext

Build number context.

public string BuildContext { get; set; }

Property Value

string

Remarks

A build host (IBuildHost) may include BuildContext in the BuildId if a unique build number is not available.

BuildNumber

Build number.

public string BuildNumber { get; set; }

Property Value

string

BuildSystemVersion

A version suitable for showing on the build system's build. Null if not set.

[JsonConverter(typeof(SemVersionJsonConverter))]
public SemVersion? BuildSystemVersion { get; set; }

Property Value

SemVersion

Remarks

The C# script may use this property update the build system's label using IBuildHost.SetBuildLabel method. See also UpdateHostBuildLabel.

Git2SemVer's default behaviour is to generate this label as:

<major>.<minor>.<patch>
<major>.<minor>.<patch>-<label>.<build number>[.<build context>]

For a prerelease build this label is shorter than Version as commit ID and branch name are usually already displayed on the build system. Having a shorter label helps readability.

FileVersion

The Microsoft assembly file version.

public Version? FileVersion { get; set; }

Property Value

Version

Remarks

This value will be written to the MSBuild FileVersion property.

To conform to common usage Git2SemVer's default approach is to make this appear as a three part Semantic Version.

This a Microsoft four part version with the format <major>.<minor>[.<build>[.<revision>]]. It is not a semantic version (notice that the build number is the third part).

See System.Version .

Git

Git repository outputs for optional C# script (csx) use.

public IGitOutputs Git { get; }

Property Value

IGitOutputs

InformationalVersion

The calculated informational version.

[JsonConverter(typeof(SemVersionJsonConverter))]
public SemVersion? InformationalVersion { get; set; }

Property Value

SemVersion

IsInInitialDevelopment

The code is in initial development phase as defined by Semantic Versioning spec 4.

public bool IsInInitialDevelopment { get; set; }

Property Value

bool

Remarks

Semantic Versioning spec 4 states that a 0 major version number indicates that the code is in initial development. The first stable release will be 1.0.0. Hence, Git2SemVer's default behaviour is to make all 0.x.x builds "InitialDev" prereleases.

So, making a first release 1.0.0 tells the consumer that it is a stable (production) release.

IsValid

True if outputs are valid.

[JsonIgnore]
public bool IsValid { get; }

Property Value

bool

Remarks

For internal use to detect default output settings.

Output1

Optional script output to MSBuild property Git2SemVer_Output1

public string Output1 { get; set; }

Property Value

string

Output2

Optional script output to MSBuild property Git2SemVer_Output2

public string Output2 { get; set; }

Property Value

string

PackageVersion

NuGet package version.

[JsonConverter(typeof(SemVersionJsonConverter))]
public SemVersion? PackageVersion { get; set; }

Property Value

SemVersion

PrereleaseLabel

The prerelease label.

public string PrereleaseLabel { get; set; }

Property Value

string

Remarks

If a release version this property is an empty string. Otherwise, it holds the prerelease label identifier such as 'beta' or 'alpha'. By convention this is used as the first Semantic Versioning identifier in the prerelease.

Version

The calculated version without metadata identifiers.

[JsonConverter(typeof(SemVersionJsonConverter))]
public SemVersion? Version { get; set; }

Property Value

SemVersion

Methods

GetReport()

public string GetReport()

Returns

string

SetAllVersionPropertiesFrom(SemVersion)

Set all version properties from provided informational version.

public void SetAllVersionPropertiesFrom(SemVersion informationalVersion)

Parameters

informationalVersion SemVersion

Remarks

When there is a consistent version formating used across all version properties, the informational version holds all required elements.

Does not update BuildNumber and BuildContext properties.

This method will:

  • 0.x.x versions are 'InitialDev' prereleases
  • Set BuildSystemVersion to Version. Consider modifying BuildSystemLabel after this method is called.

SetAllVersionPropertiesFrom(SemVersion, string, string)

Set all version properties from provided informational version.

public void SetAllVersionPropertiesFrom(SemVersion informationalVersion, string buildNumber, string buildContext)

Parameters

informationalVersion SemVersion
buildNumber string
buildContext string

Remarks

When there is a consistent version formating used across all version properties, the informational version holds all required elements.

BuildNumber and BuildContext properties are updated.

This method will:

  • 0.x.x versions are 'InitialDev' prereleases
  • Set BuildSystemVersion to Version. Consider modifying BuildSystemLabel after this method is called.