Skip to content

[ISSUE] Incorrect output for assembly-informational-version #4654

@phatcher

Description

@phatcher

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.4

Operating system

Windows

What are you seeing?

I'm trying to update my build pipeline to use GitVersion6 and have the following gitversion.yml file

workflow: GitHubFlow/v1
mode: ContinuousDelivery
branches:
    main:
        mode: ContinuousDeployment
        label: ''
    release:
        label: ''
assembly-informational-format: '{AssemblySemVer} {ShortSha}'
ignore:
    sha: []

As we don't have NugetVersion2 anymore I was trying to update the assembly-informational-format to produce the same value as under V5.

What is expected?

I'd expect to get 6.13.54-gv60002 as the InformationalVersion

Steps to Reproduce

So invoking on my gv6 branch with

dotnet-gitversion /overrideconfig assembly-informational-format="{MajorMinorPatch}{PreReleaseLabelWithDash}{CommitsSinceVersionSource:0000}"

I get

{
  "AssemblySemFileVer": "6.13.54.0",
  "AssemblySemVer": "6.13.54.0",
  "BranchName": "feature/gv6",
  "BuildMetaData": 2,
  "CommitDate": "2025-08-12",
  "CommitsSinceVersionSource": 2,
  "EscapedBranchName": "feature-gv6",
  "FullBuildMetaData": "2.Branch.feature-gv6.Sha.489a0c0ab425214def918e36399f3cc3c9a9c42d",
  "FullSemVer": "6.13.54-gv6.1+2",
  "InformationalVersion": "6.13.54-gv60002",
  "Major": 6,
  "MajorMinorPatch": "6.13.54",
  "Minor": 13,
  "Patch": 54,
  "PreReleaseLabel": "gv6",
  "PreReleaseLabelWithDash": "-gv6",
  "PreReleaseNumber": 1,
  "PreReleaseTag": "gv6.1",
  "PreReleaseTagWithDash": "-gv6.1",
  "SemVer": "6.13.54-gv6.1",
  "Sha": "489a0c0ab425214def918e36399f3cc3c9a9c42d",
  "ShortSha": "489a0c0",
  "UncommittedChanges": 0,
  "VersionSourceSha": "21d7e26e6ff58374abd3daf2177be4b7a9c49040",
  "WeightedPreReleaseNumber": 30001
}

I also want this to work correctly on the main branch so I changed the call to take advantage of the new C# formatting

dotnet-gitversion /config gitversion-new.yml /overrideconfig assembly-informational-format="{MajorMinorPatch}{PreReleaseLabelWithDash}{CommitsSinceVersionSource:0000;;''}"

which produces

{
  "AssemblySemFileVer": "6.13.54.0",
  "AssemblySemVer": "6.13.54.0",
  "BranchName": "feature/gv6",
  "BuildMetaData": 2,
  "CommitDate": "2025-08-12",
  "CommitsSinceVersionSource": 2,
  "EscapedBranchName": "feature-gv6",
  "FullBuildMetaData": "2.Branch.feature-gv6.Sha.489a0c0ab425214def918e36399f3cc3c9a9c42d",
  "FullSemVer": "6.13.54-gv6.1+2",
  "InformationalVersion": "6.13.54-gv6-CommitsSinceVersionSource-0000-----",
  "Major": 6,
  "MajorMinorPatch": "6.13.54",
  "Minor": 13,
  "Patch": 54,
  "PreReleaseLabel": "gv6",
  "PreReleaseLabelWithDash": "-gv6",
  "PreReleaseNumber": 1,
  "PreReleaseTag": "gv6.1",
  "PreReleaseTagWithDash": "-gv6.1",
  "SemVer": "6.13.54-gv6.1",
  "Sha": "489a0c0ab425214def918e36399f3cc3c9a9c42d",
  "ShortSha": "489a0c0",
  "UncommittedChanges": 0,
  "VersionSourceSha": "21d7e26e6ff58374abd3daf2177be4b7a9c49040",
  "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 type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions