Skip to content

[ISSUE]: {BranchName} format strings for label not working #4976

Description

@moppa

Prerequisites

  • I have written a descriptive issue title
  • I have searched issues to ensure it has not already been reported

GitVersion package

GitVersion.Tool

GitVersion version

6.7.0+Branch.main.Sha.00e59b5f45fe97e2e610a480a860b3a009db9602

Operating system

Windows

What are you seeing?

Format strings described on https://gitversion.net/docs/reference/custom-formatting does not work for label {BranchName} customization.

Specifying one of the format string for the BranchName regex does not print the variable with the expected formatting - but instead prints the string literal.

What is expected?

With the following configuration I expected the PascalCase formatting to be applied to BranchName like the documentation example

branches:
feature:
label: "{BranchName:c}"

On branch feature/My-New-feat

PreReleaseLabel: MyNewFeat

Steps to Reproduce

Using sample config from https://gitversion.net/docs/reference/custom-formatting "String Case Transformations"

GitVersion.yaml

branches:
  feature:
    label: "{BranchName:c}"  # PascalCase: "feature-branch" → "FeatureBranch"
# git status
On branch feature/My-New-feat
nothing to commit, working tree clean

# dotnet-gitversion /config GitVersion.yaml

{
  "AssemblySemFileVer": "1.0.277.0",
  "AssemblySemVer": "1.0.277.0",
  "BranchName": "feature/My-New-feat",
  "BuildMetaData": 484,
  "CommitDate": "2026-06-15",
  "CommitsSinceVersionSource": 484,
  "EscapedBranchName": "feature-My-New-feat",
  "FullBuildMetaData": "484.Branch.feature-My-New-feat.Sha.eec93a8ec338c7bd6928e69cc8981cba309e8408",
  "FullSemVer": "1.0.277-{BranchName:c}.1+484",
  "InformationalVersion": "1.0.277-{BranchName:c}.1+484.Branch.feature-My-New-feat.Sha.eec93a8ec338c7bd6928e69cc8981cba309e8408",
  "Major": 1,
  "MajorMinorPatch": "1.0.277",
  "Minor": 0,
  "Patch": 277,
  "PreReleaseLabel": "{BranchName:c}",
  "PreReleaseLabelWithDash": "-{BranchName:c}",
  "PreReleaseNumber": 1,
  "PreReleaseTag": "{BranchName:c}.1",
  "PreReleaseTagWithDash": "-{BranchName:c}.1",
  "SemVer": "1.0.277-{BranchName:c}.1",
  "Sha": "eec93a8ec338c7bd6928e69cc8981cba309e8408",
  "ShortSha": "eec93a8",
  "UncommittedChanges": 0,
  "VersionSourceDistance": 484,
  "VersionSourceIncrement": "None",
  "VersionSourceSemVer": "0.0.0",
  "VersionSourceSha": "",
  "WeightedPreReleaseNumber": 30001
}

RepositoryFixture Test

No response

Output log or link to your CI build (if appropriate).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions