Skip to content
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] DisableGitVersionTask ineffective #2640

Closed
NeilMacMullen opened this issue Apr 2, 2021 · 6 comments · Fixed by #2648
Closed

[Bug] DisableGitVersionTask ineffective #2640

NeilMacMullen opened this issue Apr 2, 2021 · 6 comments · Fixed by #2648
Labels
Milestone

Comments

@NeilMacMullen
Copy link

NeilMacMullen commented Apr 2, 2021

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
@NeilMacMullen
Copy link
Author

NeilMacMullen commented 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.

@Leszek-Kowalski
Copy link
Contributor

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

@NeilMacMullen NeilMacMullen changed the title [Bug] DisableGitVersionTask ineffective when running under Ncrunch [Bug] DisableGitVersionTask ineffective Apr 8, 2021
@NeilMacMullen
Copy link
Author

@Leszek-Kowalski good point - have renamed the issue to make this more obvious!

Leszek-Kowalski added a commit to Leszek-Kowalski/GitVersion that referenced this issue Apr 8, 2021
@asbjornu asbjornu added this to the 5.6.9 milestone Apr 9, 2021
asbjornu added a commit that referenced this issue Apr 9, 2021
…ersionTask-ineffective

Fixing #2640 DisableGitVersionTask ineffective
@Leszek-Kowalski
Copy link
Contributor

Hi,
Would it be possible to release 5.6.9 ?
This issue has been bugging our team for a bit too long.
Thanks :)

@xerootg
Copy link

xerootg commented Apr 22, 2021

I just spent the last 6 hours beating my head against what seems like this issue, can I bribe the gitversion team to release this or something? I'd really like to use all this goodness.

@github-actions
Copy link

🎉 This issue has been resolved in version 5.6.9 🎉
The release is available on:

Your GitReleaseManager bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants