-
Notifications
You must be signed in to change notification settings - Fork 654
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] GitVersion.MsBuild does not set Azure DevOps build number #2552
Comments
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, |
We're in the same boat too |
Hi, we have the same issue, after switching from GitVersionTask to GitVersion.MSBuild. Now, I tried to update the Build number format string by replacing it with Are there any suggestions or approaches how to set the build definition's build number during/after a build with the GitVersion.MSBuild NuGet package installed in project solution only, without using Azure DevOps Server extension? The company I'm working for will avoid to install ADO Server extensions for compatibility reasons. Thanks in advance and looking forward for replies or an updated documentation about this topic. |
Having a similar issue with GitVersion.MsBuild not setting the build number correctly in Azure Devops. While for me it is outputting the environment variables and I can use them in tasks such as NuGet packing, it isn't setting the build number correctly on the pipeline. I was having a dig round the code base and found this: GitVersion/src/GitVersion.MsBuild/GitVersionTaskExecutor.cs Lines 66 to 70 in 0cfa014
The false on line 69 is the parameter for updating the build number and is always set to false. At this point in the code there is an options class from GitVersionOptions, but i couldn't see anything there that would allow to check if updateBuildNumber had been set. I was struggling to find how the GitVersionContext (which has the updateBuildNumber flag) is turned into GitVersionOptions. The false value set above for updateBuildNumber is then passed down to the agent writer here: GitVersion/src/GitVersion.Core/Core/BuildAgentBase.cs Lines 38 to 42 in 0cfa014
As it is false it never gets written out to the agent. I can do some more digging but any pointers on how GitVersionContext becomes GitVersionOptions would be helpful or or if there is a flag already in GitVersionOptions for updateBuildNumber. Then I can test setting the hardcoded false value to something that comes from configuration and see if this solves the issue. |
Fixing this issue is not easy. During the investigation of #2592 I've found out, that the setting I've intended to simply read the actual configuration from the Root cause is, that for finding that For .NET Framework 4.8 this is not an issue, but unfortunately for .NET Core 3.1 and .NET 5. As of today, MsBuild does not support custom tasks which have a native dependency for .NET Core. This is an known issue, but not fixed yet. Previously the workaround for this issue was implemented in the PR #2221. I'm not sure if it's intended to apply the same workaround again for Another possible solution could be to change the implementation of the ConfigProvider to not use A third option would be to introduce a new MsBuild property for |
What are the benefits of switching from GitVersionTask to new GitVersion.MsBuild then? I'm hesitating between using old one where this pipeline build number update is working and a new GitVersion.MsBuild where this is broken as of now (and supposed to be fixed eventually, but no guarantee when) |
I have this same issue and question. Currently my team are all using the GitVersionTask for .NET Framework, and for .NET Core projects and works adequately. Cheers, |
The reason is GitVersionTask is obsolete and no improvements/ fixes will be made. GitVersion.MsBuild is different in the way it is packaged and adds support for more platforms including Ubuntu 20.04, and is the maintainable package |
Thanks, that is good to know, but realistically for Windows builds - does it really matter? Is there anything GitVersion.MsBuild is doing that GitVersionTask can't? |
At this moment no, it behaves similarly, but later when we'll release v6 it will be different |
Here is a workaround that could be used until the
Should be placed in *.yml pipeline file (right) after the solution/project with |
It's also possible to update the pipeline build number directly from the project file.
|
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
|
Hello everyone. Thank you for your workarounds, but for me they are all a bit invasive. Sevenate had the best fix so far. I just found out, that there is another easy fix.
Just add the I only observed, that |
This issue has been automatically marked as stale because it has not had recent activity. After 30 days from now, it will be closed if no further activity occurs. |
Commenting to keep the issue active. |
This should be fixed in 6.0.0-beta2 |
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:
However, it does not show this line:
From the git version code (src/GitVersionCore/Core/BuildAgentBase.cs), this indicates that the
updateBuildNumber
variable isfalse
:I tried adding a
GitVersion.yml
withupdate-build-number: true
, however, it did not help.Your Environment
GitVersion.yml
. If I rungitversion /showconfig
locally,update-build-number
is set totrue
.The text was updated successfully, but these errors were encountered: