[Bug] GitVersion.MsBuild does not set Azure DevOps build number
See original GitHub issueHello,
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 /showconfig
locally,update-build-number
is set totrue
. - GitVersion.MsBuild 5.6.4
Issue Analytics
- State:
- Created 3 years ago
- Reactions:13
- Comments:17 (6 by maintainers)
Top Results From Across the Web
Gitversion rolled back the version number for my NuGet ...
Multiple version of Azure DevOps build pipelines that build 10+ NuGet packages that use GitVersion MsBuild task with Mainline mode configured.
Read more >Azure DevOps
To use GitVersion's variables in the build name, just add them in the form $(GITVERSION_FullSemVer) into the Build definition's build number string. Then...
Read more >Azure DevOps Pipeline build not working
Thanks for reporting the issue on Developer Community. This seems to be caused by the upgraded build engine. MSBuild 16.5 has a new...
Read more >How to use GitVersion to get sensible versioning
A neat trick is that GitVersion understands and detects most build systems and automatically updates the build number reported to TeamCity, ...
Read more >Gitversion Azure Devops
GitVersion looks at your Git history and works out the semantic version. Azure Devops: SemVer ... [Bug] GitVersion.MsBuild does not set Azure DevOps...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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