Hello
We would like to execute GitVersion from withing a build script, but would like to get the json output. If the build environment is detected, the option json is ignored.
This was already issued once: https://github.com/GitTools/GitVersion/issues/675
Apparentely, this bug seems to be still open.
You can repro it by yourself by executing the following inside a PowerShell session:
$env:TF_BUILD = "True"
GitVersion.exe /output json /nofetch
The output is still the "buildserver" one.
@marc-mueller: Can you please tell me whether #983 would offer the same functionality you're asking for?
Not really. The output in a file would be handy, but the main problem still exists. Then GitVersion detects the build server (in our case VSTS / TFS) it automatically changes the build number. We cannot allow this since another task handles the build number.
Our current solution ist to start GitVersion in a new process where we override the environment variable "TF_BUILD" with a blank value so we get the json input. We then just parse the JSON output.
Having this output in a file instead on the standard output, does not matter since it is +/- the same effort to parse it.
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. Thank you for your contributions.
I am still having this problem on Jenkins. Any chance this will be fixed?
Same issue here with the Gitlab CI/CD pipeline. The GitVersion.exe tool doesn't honor the /output json flag. This definitely has to be fixed!


Related: #675
@tmeckel this one was implemented starting with version 5.1.4-beta1-192, can you try this version?
@arturcic First: I can try this version out next Tuesday earliest. Secondly: do I've to compile this version by myself? I couldn't find a pre-release version with that SemVer in the releases and no Git tag of that name.
you can find it here https://www.nuget.org/packages/GitVersionTask/5.1.4-beta1.229, but if you can wait, we'll soon have a 5.2.0 stable release
As I can see the NuGet Package includes the MsBuild task. We're not utilizing the MsBuild Task but the executable GitVersion.exe. Does the mentioned NuGet package include the executable as well? And what's the time frame until Release 5.2.0 is available?
wrong package, use this one https://www.nuget.org/packages/GitVersion.CommandLine/5.1.4-beta1.229, this one has the exe
I'll give this a try next week. I'll keep you updated!