question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] DisableGitVersionTask ineffective

See original GitHub issue

Describe the bug The DisableGitVersionTask property was used on the old GitVersionTask package to allow continuous test runners such as Ncrunch to operate without access to the git repository. It appears that no longer works with the new GitVersion.MsBuild package. Instead, gitversion.exe is run and then fails (due to not being able to find ‘.git’).

Expected Behavior

No gitversion tasks should be run if DisableGitVersionTask is set to true

Actual Behavior

Errors such as this occur (from NCrunch Trace Output)

NCrunch: This project was built on server '(local)'
C:\Users\neilm\.nuget\packages\gitversion.msbuild\5.6.7\tools\GitVersion.MsBuild.targets: The command ""C:\Users\neilm\.nuget\packages\gitversion.msbuild\5.6.7\tools\net48/gitversion.exe" "C:\Users\neilm\AppData\Local\NCrunch\20620\27\Textrude" -output file -outputfile obj\gitversion.json" exited with code 

This post describes the same issue (from another user).

Possible Fix

Presumably something in the twisty maze of conditional properties in GitVersion.MsBuild.props is going awry.

Steps to Reproduce

Context

Show stopper since unable to run tests

Your Environment

  • Version Used: 5.6.7 but it seems to have been broken at least as far back as 5.6.0
  • Operating System and version: Windows 10
  • Link to your project: Branch exhibiting issue
  • Link to your CI build (if appropriate): N/A - checkout and run locally with Ncrunch enabled

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Leszek-Kowalskicommented, Apr 8, 2021

DisableGitVersionTask is ineffective when running plain build via MSBuild or VS as well.

1reaction
NeilMacMullencommented, Apr 2, 2021

Quite possible I’m misunderstanding the dependency chain but shouldn’t the “GetVersion” target in GitVersion.MsBuild.targets have a condition attached?

Ie

<Target Name="GetVersion" DependsOnTargets="RunGitVersion" BeforeTargets="$(GitVersionTargetsBefore)">

should probably be

<Target Name="GetVersion" DependsOnTargets="RunGitVersion" BeforeTargets="$(GitVersionTargetsBefore)" Condition="$(GetVersion) == 'true'>

Side note - would be happy to try a PR but I can’t even run the tests after checking out the repo… LibGit2Sharp.RepositoryNotFoundException : Path 'C:\Users\neilm\AppData\Local\Temp\TestRepositories\e9db6f7f-78df-44f3-8e94-3ae18e0094bf' doesn't point at a valid Git repository or workdir.

Read more comments on GitHub >

github_iconTop Results From Across the Web

There's a breaking bug in the version of Git included with ...
My builds are failing due to this issue, what is the recommended command (CMD/Powershell) to update or install a specific version of Git...
Read more >
Two identical Azure deployments; one always throws 404
We found out what was wrong. It was not an Azure issue. The problem was that we were deploying a bad ZIP file....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found