GitVersion: [Bug] GitVersion.MsBuild does not set Azure DevOps build number
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 rungitversion /showconfiglocally,update-build-numberis set totrue. - GitVersion.MsBuild 5.6.4
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 13
- Comments: 17 (6 by maintainers)
Commits related to this issue
- Disable tests for #2552 — committed to GitTools/GitVersion by ThomasPiskol 3 years ago
Hi,
I found this bug report while looking for this exact problem. We have just switched from GitVersionTask to GitVersion.MsBuild and we have the same issue.
Thanks, David
I landed here as I was looking for a similar issue I am having with Teamcity. I used the following to get the version in teamcity
It’s also possible to update the pipeline build number directly from the project file. You should add the following lines in your .csproj:
This should be fixed in 6.0.0-beta2