Skip to content

[Bug] GitVersion.MsBuild does not set Azure DevOps build number #2552

@dagophil

Description

@dagophil

Hello,

I have a C# project that uses the GitVersionTask package. The project is built in an Azure DevOps pipeline. When running the build, the Azure DevOps build number is automatically set to the "FullSemVer". However, after upgrading GitVersionTask to GitVersion.MsBuild, the build number is not set anymore.

Expected Behavior

GitVersion.MsBuild should set the Azure DevOps build number.

Actual Behavior

GitVersion.MsBuild does not set the Azure DevOps build number.

Additional Information

The log shows the following line:

Executing GenerateBuildLogOutput for 'AzurePipelines'.

However, it does not show this line:

Executing GenerateSetVersionMessage for 'AzurePipelines'.

From the git version code (src/GitVersionCore/Core/BuildAgentBase.cs), this indicates that the updateBuildNumber variable is false:

if (updateBuildNumber)
{
    writer($"Executing GenerateSetVersionMessage for '{GetType().Name}'.");
    writer(GenerateSetVersionMessage(variables));
}
writer($"Executing GenerateBuildLogOutput for '{GetType().Name}'.");

I tried adding a GitVersion.yml with update-build-number: true, however, it did not help.

Your Environment

  • Azure DevOps pipeline.
  • Repository does not contain GitVersion.yml. If I run gitversion /showconfig locally, update-build-number is set to true.
  • GitVersion.MsBuild 5.6.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions