diff --git a/build/common/Addins/GitVersion/GitVersion.cs b/build/common/Addins/GitVersion/GitVersion.cs
index b3dd485ab2..4ef5292f92 100644
--- a/build/common/Addins/GitVersion/GitVersion.cs
+++ b/build/common/Addins/GitVersion/GitVersion.cs
@@ -6,102 +6,138 @@ namespace Common.Addins.GitVersion;
public sealed class GitVersion
{
///
- /// Gets or sets the major version.
+ /// Gets or sets the assembly semantic file version. Suitable for .NET AssemblyFileVersion. Defaults to Major.Minor.Patch.0.
///
- public int Major { get; set; }
+ public string? AssemblySemFileVer { get; set; }
///
- /// Gets or sets the minor version.
+ /// Gets or sets the assembly Semantic Version. Suitable for .NET AssemblyVersion. Defaults to Major.Minor.0.0.
///
- public int Minor { get; set; }
+ public string? AssemblySemVer { get; set; }
///
- /// Gets or sets the patch version.
+ /// Gets or sets the branch name. The name of the checked out Git branch.
///
- public int Patch { get; set; }
+ public string? BranchName { get; set; }
///
- /// Gets or sets the pre-release tag.
+ /// Gets or sets the build metadata, usually representing number of commits since the VersionSourceSha.
///
- public string? PreReleaseTag { get; set; }
+ public int? BuildMetaData { get; set; }
///
- /// Gets or sets the pre-release tag with dash.
+ /// Gets or sets the commit date. The ISO-8601 formatted date of the commit identified by Sha.
///
- public string? PreReleaseTagWithDash { get; set; }
+ public string? CommitDate { get; set; }
///
- /// Gets or sets the pre-release label.
+ /// Gets or sets the commits since version source.
///
- public string? PreReleaseLabel { get; set; }
+ [Obsolete("CommitsSinceVersionSource has been deprecated. Use VersionSourceDistance instead.")]
+ public int? CommitsSinceVersionSource { get; set; }
///
- /// Gets or sets the pre-release number.
+ /// Gets or sets the escaped branch name. Equal to BranchName, but with / replaced with -.
///
- public int? PreReleaseNumber { get; set; }
+ public string? EscapedBranchName { get; set; }
///
- /// Gets or sets the build metadata.
+ /// Gets or sets the full build metadata. The BuildMetaData suffixed with BranchName and Sha.
///
- public string? BuildMetaData { get; set; }
+ public string? FullBuildMetaData { get; set; }
///
- /// Gets or sets the major version.
+ /// Gets or sets the full Semantic Version. The full, SemVer 2.0 compliant version number.
///
- public string? FullBuildMetaData { get; set; }
+ public string? FullSemVer { get; set; }
///
- /// Gets or sets the major, minor, and path.
+ /// Gets or sets the informational version. Suitable for .NET AssemblyInformationalVersion. Defaults to FullSemVer suffixed by FullBuildMetaData.
+ ///
+ public string? InformationalVersion { get; set; }
+
+ ///
+ /// Gets or sets the major version. Should be incremented on breaking changes.
+ ///
+ public int? Major { get; set; }
+
+ ///
+ /// Gets or sets the major, minor, and patch. Major, Minor and Patch joined together, separated by '.'.
///
public string? MajorMinorPatch { get; set; }
///
- /// Gets or sets the Semantic Version.
+ /// Gets or sets the minor version. Should be incremented on new features.
///
- public string? SemVer { get; set; }
+ public int? Minor { get; set; }
///
- /// Gets or sets the assembly Semantic Version.
+ /// Gets or sets the patch version. Should be incremented on bug fixes.
///
- public string? AssemblySemVer { get; set; }
+ public int? Patch { get; set; }
///
- /// Gets or sets the assembly semantic file version.
+ /// Gets or sets the pre-release label. The pre-release label is the name of the pre-release.
///
- public string? AssemblySemFileVer { get; set; }
+ public string? PreReleaseLabel { get; set; }
///
- /// Gets or sets the full Semantic Version.
+ /// Gets or sets the pre-release label with dash. The pre-release label prefixed with a dash.
///
- public string? FullSemVer { get; set; }
+ public string? PreReleaseLabelWithDash { get; set; }
///
- /// Gets or sets the informational version.
+ /// Gets or sets the pre-release number. The pre-release number is the number of commits since the last version bump.
///
- public string? InformationalVersion { get; set; }
+ public int? PreReleaseNumber { get; set; }
///
- /// Gets or sets the branch name.
+ /// Gets or sets the pre-release tag. The pre-release tag is the pre-release label suffixed by the PreReleaseNumber.
///
- public string? BranchName { get; set; }
+ public string? PreReleaseTag { get; set; }
+
+ ///
+ /// Gets or sets the pre-release tag with dash. The pre-release tag prefixed with a dash.
+ ///
+ public string? PreReleaseTagWithDash { get; set; }
+
+ ///
+ /// Gets or sets the Semantic Version. The semantic version number, including PreReleaseTagWithDash for pre-release version numbers.
+ ///
+ public string? SemVer { get; set; }
///
- /// Gets or sets the Git SHA.
+ /// Gets or sets the Git SHA. The SHA of the Git commit.
///
public string? Sha { get; set; }
///
- /// Gets or sets the commits since version source.
+ /// Gets or sets the short SHA. The Sha limited to 7 characters.
///
- public int? CommitsSinceVersionSource { get; set; }
+ public string? ShortSha { get; set; }
+
+ ///
+ /// Gets or sets the number of uncommitted changes present in the repository.
+ ///
+ public int? UncommittedChanges { get; set; }
///
- /// Gets or sets the version source distance.
+ /// Gets or sets the version source distance. The number of commits since the version source.
///
public int? VersionSourceDistance { get; set; }
///
- /// Gets or sets the commit date.
+ /// Gets or sets the version source SemVer. The semantic version of the commit used as version source.
///
- public string? CommitDate { get; set; }
+ public string? VersionSourceSemVer { get; set; }
+
+ ///
+ /// Gets or sets the version source SHA. The SHA of the commit used as version source.
+ ///
+ public string? VersionSourceSha { get; set; }
+
+ ///
+ /// Gets or sets the weighted pre-release number. A summation of branch specific pre-release-weight and the PreReleaseNumber. Can be used to obtain a monotonically increasing version number across the branches.
+ ///
+ public int? WeightedPreReleaseNumber { get; set; }
}
diff --git a/build/common/Addins/GitVersion/GitVersionAliases.cs b/build/common/Addins/GitVersion/GitVersionAliases.cs
index e939fb1f2a..72f61441a1 100644
--- a/build/common/Addins/GitVersion/GitVersionAliases.cs
+++ b/build/common/Addins/GitVersion/GitVersionAliases.cs
@@ -3,7 +3,7 @@ namespace Common.Addins.GitVersion;
///
/// Contains functionality related to GitVersion.
///
-/// In order to use the commands for this alias, include the following in your build.cake file to download and
+/// To use the commands for this alias, include the following in your build.cake file to download and
/// install from nuget.org, or specify the ToolPath within the class:
///
/// #tool "nuget:?package=GitVersion.CommandLine"
@@ -58,7 +58,7 @@ public GitVersion GitVersion()
{
ArgumentNullException.ThrowIfNull(context);
- return GitVersion(context, new GitVersionSettings());
+ return context.GitVersion(new GitVersionSettings());
}
///
diff --git a/build/common/Utilities/Models.cs b/build/common/Utilities/Models.cs
index a90d493e16..48588ede14 100644
--- a/build/common/Utilities/Models.cs
+++ b/build/common/Utilities/Models.cs
@@ -33,7 +33,7 @@ public static BuildVersion Calculate(GitVersion gitVersion)
chocolateyVersion += $"-{prefix}{gitVersion.PreReleaseTag?.Replace(".", "-")}";
}
- if (!string.IsNullOrWhiteSpace(gitVersion.BuildMetaData))
+ if (gitVersion.BuildMetaData is not null)
{
semVersion += $"-{gitVersion.BuildMetaData}";
chocolateyVersion += $"-{gitVersion.BuildMetaData}";
diff --git a/docs/input/docs/reference/variables.md b/docs/input/docs/reference/variables.md
index 661dac335c..c55b97cdb6 100644
--- a/docs/input/docs/reference/variables.md
+++ b/docs/input/docs/reference/variables.md
@@ -11,33 +11,33 @@ what is available. For the `release/3.0.0` branch of GitVersion it shows:
```json
{
+ "AssemblySemFileVer": "3.22.11.0",
+ "AssemblySemVer": "3.22.11.0",
+ "BranchName": "release/3.022.011",
+ "BuildMetaData": 88,
+ "CommitDate": "2021-12-31",
+ "CommitsSinceVersionSource": 7,
+ "EscapedBranchName": "release-3.022.011",
+ "FullBuildMetaData": "99.Branch.release/3.22.11.Sha.28c853159a46b5a87e6cc9c4f6e940c59d6bc68a",
+ "FullSemVer": "3.22.11-beta.99+88",
+ "InformationalVersion": "3.22.11-beta.99+88.Branch.release/3.022.011.Sha.28c853159a46b5a87e6cc9c4f6e940c59d6bc68a",
"Major": 3,
+ "MajorMinorPatch": "3.22.11",
"Minor": 22,
"Patch": 11,
- "PreReleaseTag": "beta.99",
- "PreReleaseTagWithDash": "-beta.99",
"PreReleaseLabel": "beta",
"PreReleaseLabelWithDash": "-beta",
"PreReleaseNumber": 99,
- "WeightedPreReleaseNumber": 1099,
- "BuildMetaData": 88,
- "FullBuildMetaData": "99.Branch.release/3.22.11.Sha.28c853159a46b5a87e6cc9c4f6e940c59d6bc68a",
- "MajorMinorPatch": "3.22.11",
+ "PreReleaseTag": "beta.99",
+ "PreReleaseTagWithDash": "-beta.99",
"SemVer": "3.22.11-beta.99",
- "AssemblySemVer": "3.22.11.0",
- "AssemblySemFileVer": "3.22.11.0",
- "InformationalVersion": "3.22.11-beta.99+88.Branch.release/3.022.011.Sha.28c853159a46b5a87e6cc9c4f6e940c59d6bc68a",
- "FullSemVer": "3.22.11-beta.99+88",
- "BranchName": "release/3.022.011",
- "EscapedBranchName": "release-3.022.011",
"Sha": "28c853159a46b5a87e6cc9c4f6e940c59d6bc68a",
"ShortSha": "28c8531",
+ "UncommittedChanges": 0,
+ "VersionSourceDistance": 7,
"VersionSourceSemVer": "3.22.11",
"VersionSourceSha": "28c853159a46b5a87e6cc9c4f6e940c59d6bc68a",
- "CommitsSinceVersionSource": 7,
- "VersionSourceDistance": 7,
- "CommitDate": "2021-12-31",
- "UncommittedChanges": 0
+ "WeightedPreReleaseNumber": 1099
}
```
@@ -45,33 +45,33 @@ Each property of the above JSON document is described in the below table.
| Property | Description |
|----------------------------:|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| `AssemblySemFileVer` | Suitable for .NET `AssemblyFileVersion`. Defaults to `Major.Minor.Patch.0`. |
+| `AssemblySemVer` | Suitable for .NET `AssemblyVersion`. Defaults to `Major.Minor.0.0` to allow the assembly to be hotfixed without breaking existing applications that may be referencing it. |
+| `BranchName` | The name of the checked out Git branch. |
+| `BuildMetaData` | The build metadata, usually representing number of commits since the `VersionSourceSha`. Despite its name, will not increment for every build. |
+| `CommitDate` | The ISO-8601 formatted date of the commit identified by `Sha`. |
+| `CommitsSinceVersionSource` | (Deprecated: use `VersionSourceDistance` instead) The number of commits since the version source. |
+| `EscapedBranchName` | Equal to `BranchName`, but with `/` replaced with `-`. |
+| `FullBuildMetaData` | The `BuildMetaData` suffixed with `BranchName` and `Sha`. |
+| `FullSemVer` | The full, SemVer 2.0 compliant version number. |
+| `InformationalVersion` | Suitable for .NET `AssemblyInformationalVersion`. Defaults to `FullSemVer` suffixed by `FullBuildMetaData`. |
| `Major` | The major version. Should be incremented on breaking changes. |
+| `MajorMinorPatch` | `Major`, `Minor` and `Patch` joined together, separated by `.`. |
| `Minor` | The minor version. Should be incremented on new features. |
| `Patch` | The patch version. Should be incremented on bug fixes. |
-| `PreReleaseTag` | The pre-release tag is the pre-release label suffixed by the `PreReleaseNumber`. |
-| `PreReleaseTagWithDash` | The pre-release tag prefixed with a dash. |
| `PreReleaseLabel` | The pre-release label. |
| `PreReleaseLabelWithDash` | The pre-release label prefixed with a dash. |
| `PreReleaseNumber` | The pre-release number. |
-| `WeightedPreReleaseNumber` | A summation of branch specific `pre-release-weight` and the `PreReleaseNumber`. Can be used to obtain a monotonically increasing version number across the branches. |
-| `BuildMetaData` | The build metadata, usually representing number of commits since the `VersionSourceSha`. Despite its name, will not increment for every build. |
-| `FullBuildMetaData` | The `BuildMetaData` suffixed with `BranchName` and `Sha`. |
-| `MajorMinorPatch` | `Major`, `Minor` and `Patch` joined together, separated by `.`. |
+| `PreReleaseTag` | The pre-release tag is the pre-release label suffixed by the `PreReleaseNumber`. |
+| `PreReleaseTagWithDash` | The pre-release tag prefixed with a dash. |
| `SemVer` | The semantical version number, including `PreReleaseTagWithDash` for pre-release version numbers. |
-| `AssemblySemVer` | Suitable for .NET `AssemblyVersion`. Defaults to `Major.Minor.0.0` to allow the assembly to be hotfixed without breaking existing applications that may be referencing it. |
-| `AssemblySemFileVer` | Suitable for .NET `AssemblyFileVersion`. Defaults to `Major.Minor.Patch.0`. |
-| `InformationalVersion` | Suitable for .NET `AssemblyInformationalVersion`. Defaults to `FullSemVer` suffixed by `FullBuildMetaData`. |
-| `FullSemVer` | The full, SemVer 2.0 compliant version number. |
-| `BranchName` | The name of the checked out Git branch. |
-| `EscapedBranchName` | Equal to `BranchName`, but with `/` replaced with `-`. |
| `Sha` | The SHA of the Git commit. |
| `ShortSha` | The `Sha` limited to 7 characters. |
+| `UncommittedChanges` | The number of uncommitted changes present in the repository. |
+| `VersionSourceDistance` | The number of commits since the version source. |
| `VersionSourceSemVer` | The semantic version of the commit used as version source. |
| `VersionSourceSha` | The SHA of the commit used as version source. |
-| `CommitsSinceVersionSource` | (Deprecated: use `VersionSourceDistance` instead) The number of commits since the version source. |
-| `VersionSourceDistance` | The number of commits since the version source. |
-| `CommitDate` | The ISO-8601 formatted date of the commit identified by `Sha`. |
-| `UncommittedChanges` | The number of uncommitted changes present in the repository. |
+| `WeightedPreReleaseNumber` | A summation of branch specific `pre-release-weight` and the `PreReleaseNumber`. Can be used to obtain a monotonically increasing version number across the branches. |
Depending on how and in which context GitVersion is executed (for instance
within a [supported build server][build-servers]), the above version variables
diff --git a/src/GitVersion.Core.Tests/Helpers/TestableGitVersionVariables.cs b/src/GitVersion.Core.Tests/Helpers/TestableGitVersionVariables.cs
index a23e8f46e8..23f854c139 100644
--- a/src/GitVersion.Core.Tests/Helpers/TestableGitVersionVariables.cs
+++ b/src/GitVersion.Core.Tests/Helpers/TestableGitVersionVariables.cs
@@ -3,30 +3,31 @@
namespace GitVersion.Core.Tests.Helpers;
internal record TestableGitVersionVariables() : GitVersionVariables(
- Major: "",
- Minor: "",
- Patch: "",
- BuildMetaData: "",
- FullBuildMetaData: "",
+ AssemblySemFileVer: "",
+ AssemblySemVer: "",
BranchName: "",
+ BuildMetaData: "",
+ CommitDate: "",
+ CommitsSinceVersionSource: "",
EscapedBranchName: "",
- Sha: "",
- ShortSha: "",
- MajorMinorPatch: "",
- SemVer: "",
+ FullBuildMetaData: "",
FullSemVer: "",
- AssemblySemVer: "",
- AssemblySemFileVer: "",
- PreReleaseTag: "",
- PreReleaseTagWithDash: "",
+ InformationalVersion: "",
+ Major: "",
+ MajorMinorPatch: "",
+ Minor: "",
+ Patch: "",
PreReleaseLabel: "",
PreReleaseLabelWithDash: "",
PreReleaseNumber: "",
- WeightedPreReleaseNumber: "",
- InformationalVersion: "",
- CommitDate: "",
+ PreReleaseTag: "",
+ PreReleaseTagWithDash: "",
+ SemVer: "",
+ Sha: "",
+ ShortSha: "",
+ UncommittedChanges: "",
+ VersionSourceDistance: "",
VersionSourceSemVer: "",
VersionSourceSha: "",
- CommitsSinceVersionSource: "",
- VersionSourceDistance: "",
- UncommittedChanges: "");
+ WeightedPreReleaseNumber: ""
+);
diff --git a/src/GitVersion.Core/OutputVariables/GitVersionVariables.cs b/src/GitVersion.Core/OutputVariables/GitVersionVariables.cs
index 0a74e23463..c9550c8a49 100644
--- a/src/GitVersion.Core/OutputVariables/GitVersionVariables.cs
+++ b/src/GitVersion.Core/OutputVariables/GitVersionVariables.cs
@@ -1,104 +1,101 @@
namespace GitVersion.OutputVariables;
-public record GitVersionVariables(string Major,
- string Minor,
- string Patch,
- string? BuildMetaData,
- string? FullBuildMetaData,
- string? BranchName,
- string? EscapedBranchName,
- string? Sha,
- string? ShortSha,
- string MajorMinorPatch,
- string SemVer,
- string FullSemVer,
- string? AssemblySemVer,
- string? AssemblySemFileVer,
- string? PreReleaseTag,
- string? PreReleaseTagWithDash,
- string? PreReleaseLabel,
- string? PreReleaseLabelWithDash,
- string? PreReleaseNumber,
- string WeightedPreReleaseNumber,
- string? InformationalVersion,
- string? CommitDate,
- string? VersionSourceSemVer,
- string? VersionSourceSha,
- [property: Obsolete("CommitsSinceVersionSource has been deprecated. Use VersionSourceDistance instead.")]
- string? CommitsSinceVersionSource,
- string? VersionSourceDistance,
- string? UncommittedChanges) : IEnumerable>
+public record GitVersionVariables(
+ string? AssemblySemFileVer,
+ string? AssemblySemVer,
+ string? BranchName,
+ string? BuildMetaData,
+ string? CommitDate,
+ [property: Obsolete("CommitsSinceVersionSource has been deprecated. Use VersionSourceDistance instead.")]
+ string? CommitsSinceVersionSource,
+ string? EscapedBranchName,
+ string? FullBuildMetaData,
+ string FullSemVer,
+ string? InformationalVersion,
+ string Major,
+ string MajorMinorPatch,
+ string Minor,
+ string Patch,
+ string? PreReleaseLabel,
+ string? PreReleaseLabelWithDash,
+ string? PreReleaseNumber,
+ string? PreReleaseTag,
+ string? PreReleaseTagWithDash,
+ string SemVer,
+ string? Sha,
+ string? ShortSha,
+ string? UncommittedChanges,
+ string? VersionSourceDistance,
+ string? VersionSourceSemVer,
+ string? VersionSourceSha,
+ string WeightedPreReleaseNumber
+) : IEnumerable>
{
internal static readonly List AvailableVariables =
[
- nameof(Major),
- nameof(Minor),
- nameof(Patch),
- nameof(BuildMetaData),
- nameof(FullBuildMetaData),
+ nameof(AssemblySemFileVer),
+ nameof(AssemblySemVer),
nameof(BranchName),
+ nameof(BuildMetaData),
+ nameof(CommitDate),
+ nameof(CommitsSinceVersionSource),
nameof(EscapedBranchName),
- nameof(Sha),
- nameof(ShortSha),
- nameof(MajorMinorPatch),
- nameof(SemVer),
+ nameof(FullBuildMetaData),
nameof(FullSemVer),
- nameof(AssemblySemVer),
- nameof(AssemblySemFileVer),
- nameof(PreReleaseTag),
- nameof(PreReleaseTagWithDash),
+ nameof(InformationalVersion),
+ nameof(Major),
+ nameof(MajorMinorPatch),
+ nameof(Minor),
+ nameof(Patch),
nameof(PreReleaseLabel),
nameof(PreReleaseLabelWithDash),
nameof(PreReleaseNumber),
- nameof(WeightedPreReleaseNumber),
- nameof(InformationalVersion),
- nameof(CommitDate),
+ nameof(PreReleaseTag),
+ nameof(PreReleaseTagWithDash),
+ nameof(SemVer),
+ nameof(Sha),
+ nameof(ShortSha),
+ nameof(UncommittedChanges),
+ nameof(VersionSourceDistance),
nameof(VersionSourceSemVer),
nameof(VersionSourceSha),
- nameof(CommitsSinceVersionSource),
- nameof(VersionSourceDistance),
- nameof(UncommittedChanges)
+ nameof(WeightedPreReleaseNumber)
];
- private Dictionary Instance => new()
+ private Dictionary Instance => field ??= new()
{
- { nameof(Major), Major },
- { nameof(Minor), Minor },
- { nameof(Patch), Patch },
- { nameof(BuildMetaData), BuildMetaData },
- { nameof(FullBuildMetaData), FullBuildMetaData },
+ { nameof(AssemblySemFileVer), AssemblySemFileVer },
+ { nameof(AssemblySemVer), AssemblySemVer },
{ nameof(BranchName), BranchName },
+ { nameof(BuildMetaData), BuildMetaData },
+ { nameof(CommitDate), CommitDate },
+ { nameof(CommitsSinceVersionSource), CommitsSinceVersionSource },
{ nameof(EscapedBranchName), EscapedBranchName },
- { nameof(Sha), Sha },
- { nameof(ShortSha), ShortSha },
- { nameof(MajorMinorPatch), MajorMinorPatch },
- { nameof(SemVer), SemVer },
+ { nameof(FullBuildMetaData), FullBuildMetaData },
{ nameof(FullSemVer), FullSemVer },
- { nameof(AssemblySemVer), AssemblySemVer },
- { nameof(AssemblySemFileVer), AssemblySemFileVer },
- { nameof(PreReleaseTag), PreReleaseTag },
- { nameof(PreReleaseTagWithDash), PreReleaseTagWithDash },
+ { nameof(InformationalVersion), InformationalVersion },
+ { nameof(Major), Major },
+ { nameof(MajorMinorPatch), MajorMinorPatch },
+ { nameof(Minor), Minor },
+ { nameof(Patch), Patch },
{ nameof(PreReleaseLabel), PreReleaseLabel },
{ nameof(PreReleaseLabelWithDash), PreReleaseLabelWithDash },
{ nameof(PreReleaseNumber), PreReleaseNumber },
- { nameof(WeightedPreReleaseNumber), WeightedPreReleaseNumber },
- { nameof(InformationalVersion), InformationalVersion },
- { nameof(CommitDate), CommitDate },
+ { nameof(PreReleaseTag), PreReleaseTag },
+ { nameof(PreReleaseTagWithDash), PreReleaseTagWithDash },
+ { nameof(SemVer), SemVer },
+ { nameof(Sha), Sha },
+ { nameof(ShortSha), ShortSha },
+ { nameof(UncommittedChanges), UncommittedChanges },
+ { nameof(VersionSourceDistance), VersionSourceDistance },
{ nameof(VersionSourceSemVer), VersionSourceSemVer },
{ nameof(VersionSourceSha), VersionSourceSha },
- { nameof(CommitsSinceVersionSource), CommitsSinceVersionSource },
- { nameof(VersionSourceDistance), VersionSourceDistance },
- { nameof(UncommittedChanges), UncommittedChanges }
+ { nameof(WeightedPreReleaseNumber), WeightedPreReleaseNumber }
};
public IEnumerator> GetEnumerator() => Instance.GetEnumerator();
- IEnumerator IEnumerable.GetEnumerator() => Instance.GetEnumerator();
+ IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
- public bool TryGetValue(string variable, out string? variableValue)
- {
- if (Instance.TryGetValue(variable, out variableValue)) return true;
- variableValue = null;
- return false;
- }
+ public bool TryGetValue(string variable, out string? variableValue) => Instance.TryGetValue(variable, out variableValue);
}
diff --git a/src/GitVersion.Core/PublicAPI.Unshipped.txt b/src/GitVersion.Core/PublicAPI.Unshipped.txt
index 67343e3ea4..0ae491b345 100644
--- a/src/GitVersion.Core/PublicAPI.Unshipped.txt
+++ b/src/GitVersion.Core/PublicAPI.Unshipped.txt
@@ -1,6 +1,6 @@
#nullable enable
-GitVersion.OutputVariables.GitVersionVariables.Deconstruct(out string! Major, out string! Minor, out string! Patch, out string? BuildMetaData, out string? FullBuildMetaData, out string? BranchName, out string? EscapedBranchName, out string? Sha, out string? ShortSha, out string! MajorMinorPatch, out string! SemVer, out string! FullSemVer, out string? AssemblySemVer, out string? AssemblySemFileVer, out string? PreReleaseTag, out string? PreReleaseTagWithDash, out string? PreReleaseLabel, out string? PreReleaseLabelWithDash, out string? PreReleaseNumber, out string! WeightedPreReleaseNumber, out string? InformationalVersion, out string? CommitDate, out string? VersionSourceSemVer, out string? VersionSourceSha, out string? CommitsSinceVersionSource, out string? VersionSourceDistance, out string? UncommittedChanges) -> void
-GitVersion.OutputVariables.GitVersionVariables.GitVersionVariables(string! Major, string! Minor, string! Patch, string? BuildMetaData, string? FullBuildMetaData, string? BranchName, string? EscapedBranchName, string? Sha, string? ShortSha, string! MajorMinorPatch, string! SemVer, string! FullSemVer, string? AssemblySemVer, string? AssemblySemFileVer, string? PreReleaseTag, string? PreReleaseTagWithDash, string? PreReleaseLabel, string? PreReleaseLabelWithDash, string? PreReleaseNumber, string! WeightedPreReleaseNumber, string? InformationalVersion, string? CommitDate, string? VersionSourceSemVer, string? VersionSourceSha, string? CommitsSinceVersionSource, string? VersionSourceDistance, string? UncommittedChanges) -> void
+GitVersion.OutputVariables.GitVersionVariables.Deconstruct(out string? AssemblySemFileVer, out string? AssemblySemVer, out string? BranchName, out string? BuildMetaData, out string? CommitDate, out string? CommitsSinceVersionSource, out string? EscapedBranchName, out string? FullBuildMetaData, out string! FullSemVer, out string? InformationalVersion, out string! Major, out string! MajorMinorPatch, out string! Minor, out string! Patch, out string? PreReleaseLabel, out string? PreReleaseLabelWithDash, out string? PreReleaseNumber, out string? PreReleaseTag, out string? PreReleaseTagWithDash, out string! SemVer, out string? Sha, out string? ShortSha, out string? UncommittedChanges, out string? VersionSourceDistance, out string? VersionSourceSemVer, out string? VersionSourceSha, out string! WeightedPreReleaseNumber) -> void
+GitVersion.OutputVariables.GitVersionVariables.GitVersionVariables(string? AssemblySemFileVer, string? AssemblySemVer, string? BranchName, string? BuildMetaData, string? CommitDate, string? CommitsSinceVersionSource, string? EscapedBranchName, string? FullBuildMetaData, string! FullSemVer, string? InformationalVersion, string! Major, string! MajorMinorPatch, string! Minor, string! Patch, string? PreReleaseLabel, string? PreReleaseLabelWithDash, string? PreReleaseNumber, string? PreReleaseTag, string? PreReleaseTagWithDash, string! SemVer, string? Sha, string? ShortSha, string? UncommittedChanges, string? VersionSourceDistance, string? VersionSourceSemVer, string? VersionSourceSha, string! WeightedPreReleaseNumber) -> void
GitVersion.OutputVariables.GitVersionVariables.VersionSourceDistance.get -> string?
GitVersion.OutputVariables.GitVersionVariables.VersionSourceDistance.init -> void
GitVersion.OutputVariables.GitVersionVariables.VersionSourceSemVer.get -> string?
diff --git a/src/GitVersion.Core/VersionCalculation/VariableProvider.cs b/src/GitVersion.Core/VersionCalculation/VariableProvider.cs
index faf0db6ad0..8ac2a40025 100644
--- a/src/GitVersion.Core/VersionCalculation/VariableProvider.cs
+++ b/src/GitVersion.Core/VersionCalculation/VariableProvider.cs
@@ -40,34 +40,33 @@ public GitVersionVariables GetVariablesFor(
);
return new(
- semverFormatValues.Major,
- semverFormatValues.Minor,
- semverFormatValues.Patch,
- semverFormatValues.BuildMetaData,
- semverFormatValues.FullBuildMetaData,
- semverFormatValues.BranchName,
- semverFormatValues.EscapedBranchName,
- semverFormatValues.Sha,
- semverFormatValues.ShortSha,
- semverFormatValues.MajorMinorPatch,
- semverFormatValues.SemVer,
- semverFormatValues.FullSemVer,
- assemblySemVer,
- assemblyFileSemVer,
- semverFormatValues.PreReleaseTag,
- semverFormatValues.PreReleaseTagWithDash,
- semverFormatValues.PreReleaseLabel,
- semverFormatValues.PreReleaseLabelWithDash,
- semverFormatValues.PreReleaseNumber,
- semverFormatValues.WeightedPreReleaseNumber,
- informationalVersion,
- semverFormatValues.CommitDate,
- semverFormatValues.VersionSourceSemVer,
- semverFormatValues.VersionSourceSha,
- semverFormatValues.VersionSourceDistance,
- semverFormatValues.VersionSourceDistance,
- semverFormatValues.UncommittedChanges
- );
+ AssemblySemFileVer: assemblyFileSemVer,
+ AssemblySemVer: assemblySemVer,
+ BranchName: semverFormatValues.BranchName,
+ BuildMetaData: semverFormatValues.BuildMetaData,
+ CommitDate: semverFormatValues.CommitDate,
+ CommitsSinceVersionSource: semverFormatValues.VersionSourceDistance,
+ EscapedBranchName: semverFormatValues.EscapedBranchName,
+ FullBuildMetaData: semverFormatValues.FullBuildMetaData,
+ FullSemVer: semverFormatValues.FullSemVer,
+ InformationalVersion: informationalVersion,
+ Major: semverFormatValues.Major,
+ MajorMinorPatch: semverFormatValues.MajorMinorPatch,
+ Minor: semverFormatValues.Minor,
+ Patch: semverFormatValues.Patch,
+ PreReleaseLabel: semverFormatValues.PreReleaseLabel,
+ PreReleaseLabelWithDash: semverFormatValues.PreReleaseLabelWithDash,
+ PreReleaseNumber: semverFormatValues.PreReleaseNumber,
+ PreReleaseTag: semverFormatValues.PreReleaseTag,
+ PreReleaseTagWithDash: semverFormatValues.PreReleaseTagWithDash,
+ SemVer: semverFormatValues.SemVer,
+ Sha: semverFormatValues.Sha,
+ ShortSha: semverFormatValues.ShortSha,
+ UncommittedChanges: semverFormatValues.UncommittedChanges,
+ VersionSourceDistance: semverFormatValues.VersionSourceDistance,
+ VersionSourceSemVer: semverFormatValues.VersionSourceSemVer,
+ VersionSourceSha: semverFormatValues.VersionSourceSha,
+ WeightedPreReleaseNumber: semverFormatValues.WeightedPreReleaseNumber);
}
private string? CheckAndFormatString(string? formatString, T source, string? defaultValue, string formatVarName)
@@ -83,7 +82,7 @@ public GitVersionVariables GetVariablesFor(
try
{
formattedString = formatString.FormatWith(source, this.environment)
- .RegexReplace(RegexPatterns.Output.SanitizeAssemblyInfoRegexPattern, "-");
+ .RegexReplace(RegexPatterns.Output.SanitizeAssemblyInfoRegexPattern, "-");
}
catch (ArgumentException exception)
{
diff --git a/src/GitVersion.MsBuild/Tasks/GetVersion.cs b/src/GitVersion.MsBuild/Tasks/GetVersion.cs
index 6f1b16ed58..dcf9f76730 100644
--- a/src/GitVersion.MsBuild/Tasks/GetVersion.cs
+++ b/src/GitVersion.MsBuild/Tasks/GetVersion.cs
@@ -5,84 +5,84 @@ namespace GitVersion.MsBuild.Tasks;
public class GetVersion : GitVersionTaskBase
{
[Output]
- public string Major { get; set; }
+ public string AssemblySemFileVer { get; set; }
[Output]
- public string Minor { get; set; }
+ public string AssemblySemVer { get; set; }
[Output]
- public string Patch { get; set; }
+ public string BranchName { get; set; }
[Output]
- public string PreReleaseTag { get; set; }
+ public string BuildMetaData { get; set; }
[Output]
- public string PreReleaseTagWithDash { get; set; }
+ public string CommitDate { get; set; }
[Output]
- public string PreReleaseLabel { get; set; }
+ [Obsolete("CommitsSinceVersionSource has been deprecated. Use VersionSourceDistance instead.")]
+ public string CommitsSinceVersionSource { get; set; }
[Output]
- public string PreReleaseLabelWithDash { get; set; }
+ public string EscapedBranchName { get; set; }
[Output]
- public string PreReleaseNumber { get; set; }
+ public string FullBuildMetaData { get; set; }
[Output]
- public string WeightedPreReleaseNumber { get; set; }
+ public string FullSemVer { get; set; }
[Output]
- public string BuildMetaData { get; set; }
+ public string InformationalVersion { get; set; }
[Output]
- public string FullBuildMetaData { get; set; }
+ public string Major { get; set; }
[Output]
public string MajorMinorPatch { get; set; }
[Output]
- public string SemVer { get; set; }
+ public string Minor { get; set; }
[Output]
- public string AssemblySemVer { get; set; }
+ public string Patch { get; set; }
[Output]
- public string AssemblySemFileVer { get; set; }
+ public string PreReleaseLabel { get; set; }
[Output]
- public string FullSemVer { get; set; }
+ public string PreReleaseLabelWithDash { get; set; }
[Output]
- public string InformationalVersion { get; set; }
+ public string PreReleaseNumber { get; set; }
[Output]
- public string BranchName { get; set; }
+ public string PreReleaseTag { get; set; }
[Output]
- public string EscapedBranchName { get; set; }
+ public string PreReleaseTagWithDash { get; set; }
[Output]
- public string Sha { get; set; }
+ public string SemVer { get; set; }
[Output]
- public string ShortSha { get; set; }
+ public string Sha { get; set; }
[Output]
- public string CommitDate { get; set; }
+ public string ShortSha { get; set; }
[Output]
- public string VersionSourceSemVer { get; set; }
+ public string UncommittedChanges { get; set; }
[Output]
- public string VersionSourceSha { get; set; }
+ public string VersionSourceDistance { get; set; }
[Output]
- [Obsolete("CommitsSinceVersionSource has been deprecated. Use VersionSourceDistance instead.")]
- public string CommitsSinceVersionSource { get; set; }
+ public string VersionSourceSemVer { get; set; }
[Output]
- public string VersionSourceDistance { get; set; }
+ public string VersionSourceSha { get; set; }
[Output]
- public string UncommittedChanges { get; set; }
+ public string WeightedPreReleaseNumber { get; set; }
}
diff --git a/src/GitVersion.MsBuild/msbuild/tools/GitVersion.MsBuild.targets b/src/GitVersion.MsBuild/msbuild/tools/GitVersion.MsBuild.targets
index c1b6dadb29..3dba803ebf 100644
--- a/src/GitVersion.MsBuild/msbuild/tools/GitVersion.MsBuild.targets
+++ b/src/GitVersion.MsBuild/msbuild/tools/GitVersion.MsBuild.targets
@@ -39,33 +39,33 @@
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
+
+
-
-
-
+
@@ -81,33 +81,33 @@
+ GitVersion_AssemblySemFileVer=$(GitVersion_AssemblySemFileVer);$(DefineConstants)
+ GitVersion_AssemblySemVer=$(GitVersion_AssemblySemVer);$(DefineConstants)
+ GitVersion_BranchName=$(GitVersion_BranchName);$(DefineConstants)
+ GitVersion_BuildMetaData=$(GitVersion_BuildMetaData);$(DefineConstants)
+ GitVersion_CommitDate=$(GitVersion_CommitDate);$(DefineConstants)
+ GitVersion_CommitsSinceVersionSource=$(GitVersion_CommitsSinceVersionSource);$(DefineConstants)
+ GitVersion_EscapedBranchName=$(GitVersion_EscapedBranchName);$(DefineConstants)
+ GitVersion_FullBuildMetaData=$(GitVersion_FullBuildMetaData);$(DefineConstants)
+ GitVersion_FullSemVer=$(GitVersion_FullSemVer);$(DefineConstants)
+ GitVersion_InformationalVersion=$(GitVersion_InformationalVersion);$(DefineConstants)
GitVersion_Major=$(GitVersion_Major);$(DefineConstants)
+ GitVersion_MajorMinorPatch=$(GitVersion_MajorMinorPatch);$(DefineConstants)
GitVersion_Minor=$(GitVersion_Minor);$(DefineConstants)
GitVersion_Patch=$(GitVersion_Patch);$(DefineConstants)
- GitVersion_PreReleaseTag=$(GitVersion_PreReleaseTag);$(DefineConstants)
- GitVersion_PreReleaseTagWithDash=$(GitVersion_PreReleaseTagWithDash);$(DefineConstants)
GitVersion_PreReleaseLabel=$(GitVersion_PreReleaseLabel);$(DefineConstants)
- GitVersion_PreReleaseLabelWithDash=$(GitVersion_PreReleaseLabeWithDashl);$(DefineConstants)
+ GitVersion_PreReleaseLabelWithDash=$(GitVersion_PreReleaseLabelWithDash);$(DefineConstants)
GitVersion_PreReleaseNumber=$(GitVersion_PreReleaseNumber);$(DefineConstants)
- GitVersion_WeightedPreReleaseNumber=$(GitVersion_WeightedPreReleaseNumber);$(DefineConstants)
- GitVersion_BuildMetaData=$(GitVersion_BuildMetaData);$(DefineConstants)
- GitVersion_FullBuildMetaData=$(GitVersion_FullBuildMetaData);$(DefineConstants)
- GitVersion_MajorMinorPatch=$(GitVersion_MajorMinorPatch);$(DefineConstants)
+ GitVersion_PreReleaseTag=$(GitVersion_PreReleaseTag);$(DefineConstants)
+ GitVersion_PreReleaseTagWithDash=$(GitVersion_PreReleaseTagWithDash);$(DefineConstants)
GitVersion_SemVer=$(GitVersion_SemVer);$(DefineConstants)
- GitVersion_AssemblySemVer=$(GitVersion_AssemblySemVer);$(DefineConstants)
- GitVersion_AssemblySemFileVer=$(GitVersion_AssemblySemFileVer);$(DefineConstants)
- GitVersion_FullSemVer=$(GitVersion_FullSemVer);$(DefineConstants)
- GitVersion_InformationalVersion=$(GitVersion_InformationalVersion);$(DefineConstants)
- GitVersion_BranchName=$(GitVersion_BranchName);$(DefineConstants)
- GitVersion_EscapedBranchName=$(GitVersion_EscapedBranchName);$(DefineConstants)
GitVersion_Sha=$(GitVersion_Sha);$(DefineConstants)
GitVersion_ShortSha=$(GitVersion_ShortSha);$(DefineConstants)
- GitVersion_CommitDate=$(GitVersion_CommitDate);$(DefineConstants)
- GitVersion_VersionSourceSha=$(GitVersion_VersionSourceSha);$(DefineConstants)
- GitVersion_VersionSourceSemVer=$(GitVersion_VersionSourceSemVer);$(DefineConstants)
- GitVersion_CommitsSinceVersionSource=$(GitVersion_CommitsSinceVersionSource);$(DefineConstants)
- GitVersion_VersionSourceDistance=$(GitVersion_VersionSourceDistance);$(DefineConstants)
GitVersion_UncommittedChanges=$(GitVersion_UncommittedChanges);$(DefineConstants)
+ GitVersion_VersionSourceDistance=$(GitVersion_VersionSourceDistance);$(DefineConstants)
+ GitVersion_VersionSourceSemVer=$(GitVersion_VersionSourceSemVer);$(DefineConstants)
+ GitVersion_VersionSourceSha=$(GitVersion_VersionSourceSha);$(DefineConstants)
+ GitVersion_WeightedPreReleaseNumber=$(GitVersion_WeightedPreReleaseNumber);$(DefineConstants)