Table of Contents

Interface IVersionOutputs

Namespace
NoeticTools.Git2SemVer.Framework.Generation
Assembly
NoeticTools.Git2SemVer.Framework.dll

Task outputs for C# script use and source for MSBuild output properties.

public interface IVersionOutputs

Properties

AssemblyVersion

The Microsoft assembly version.

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.

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.

string BuildNumber { get; set; }

Property Value

string

BuildSystemVersion

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

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.

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.

IGitOutputs Git { get; }

Property Value

IGitOutputs

InformationalVersion

The calculated informational version.

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

Property Value

SemVersion

IsInInitialDevelopment

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

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]
bool IsValid { get; }

Property Value

bool

Remarks

For internal use to detect default output settings.

Output1

Optional script output to MSBuild property Git2SemVer_Output1

string Output1 { get; set; }

Property Value

string

Output2

Optional script output to MSBuild property Git2SemVer_Output2

string Output2 { get; set; }

Property Value

string

PackageVersion

NuGet package version.

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

Property Value

SemVersion

PrereleaseLabel

The prerelease label.

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))]
SemVersion? Version { get; set; }

Property Value

SemVersion

Methods

GetReport()

string GetReport()

Returns

string

SetAllVersionPropertiesFrom(SemVersion)

Set all version properties from provided informational version.

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.

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.