[Bug] DisableGitVersionTask ineffective
See original GitHub issueDescribe 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:
- Created 2 years ago
- Reactions:1
- Comments:6 (2 by maintainers)
Top 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 >
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
DisableGitVersionTask is ineffective when running plain build via MSBuild or VS as well.
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.