arturcic on 5.3.6
hi everyone, I'm trying to use GitVersion with Nuke Build within a DevOps Pipeline. Do I really need to install the UseGitVersion extension from Marketplace to be able to inject the variables in the code as
[GitVersion] readonly GitVersion GitVersion;
? For now I'm getting the following error:
> C:\Users\VssAdministrator\.nuget\packages\gitversion.commandline\5.3.4\tools\gitversion.exe ##[error]Process 'gitversion.exe' exited with code 1.
I noticed one trouble in version 5.3.4.
I have some c# projects on .net Core and .net Standard in one solution.
And I have “Directory.Build.props” in core directory of solution
But when I build this project, I get this message
Target "UpdateAssemblyInfo" skipped, due to false condition; ($(UpdateAssemblyInfo) == 'true') was evaluated as (false == 'true').
Property reassignment: $(UpdateAssemblyInfo)="false" (previous value: "true") at \.nuget\packages\gitversiontask\5.3.4\build\GitVersionTask.props (22,9)
and the version is "0.0.0.0"
In version 5.0.1 it works fine and write current version of file.
Also, if I insert “<UpdateAssemblyInfo>true</UpdateAssemblyInfo>” into the project itself, version calculation and writing is successful.
Propertiesdirectory. The command-line version does a recursive look. My AssemblyInfo.cs is currently at the root of the netstandard project. How can I verify that the MSBuild
GitVersionTaskis working correctly?
-output json(by default I think gitversion runs with
-output buildserverwhen running on azure).
$ git clone https://github.com/owner/repo.git owner/repo Cloning into 'owner/repo'... $ cd owner/repo $ git fetch origin +refs/pull/33/merge: From https://github.com/owner/repo * branch refs/pull/33/merge -> FETCH_HEAD $ git checkout -qf FETCH_HEAD
It looks like the branch being examined is a detached Head pointing to commit '4786479'. Without a proper branch name GitVersion cannot determine the build version.
@nmbro I took a quick look at the config that travis-ci reports to use: https://travis-ci.com/github/nmbro/travis-gitversion/jobs/356052758/config
and from the looks of it, it seems it doesn't respect that you use
git: depth: false (I don't know if this is something related to using travis-ci.com, as for my own repository on travis-ci.org it respects it), and from looking at the build output from that build it indeed uses a depth flag of 50: https://travis-ci.com/github/nmbro/travis-gitversion/jobs/356052758#L113
Try adding to your yaml file a call to
git fetch --unshallow, I believe this should then get gitversion to work for you (since the build didn't respect the git depth value).
@nmbro adding that in a PR don't help, travis (same with appveyor) don't use the yaml file from the pull request, but from the target branch.
So it would need to be added in the repository directly.
You can see the config used on that build here: https://travis-ci.com/github/nmbro/travis-gitversion/jobs/356052758/config