Build/Test Issues

GitVersion.MSBuild error

Started by Tim Long on 5,375 views

I have recently migrated from GitVersion.Task to GitVersion.MSBuild (the former being deprecated) and now I'm getting this build error:


C:\Users\Tim\.nuget\packages\gitversion.msbuild\5.6.3\tools\GitVersion.MsBuild.targets: The command "C:\Users\Tim\.nuget\packages\gitversion.msbuild\5.6.3\tools\net48/gitversion.exe C:\Users\Tim\AppData\Local\NCrunch\12004\2\TA.Ascom.ReactiveCommunications -output file -outputfile obj\/gitversion.json" exited with code 1.


I'm thinking that's mostly a GitVersion problem, however I do have DisableGitVersionTask = True in my build properties, so it probably shouldn't even be running. I'm not sure if the name of the property needs to change or what?

--Tim

Edited

Hi Tim,

Unfortunately I have no experience with this package, but my guess would be that it has a dependency on something that isn't being copied to the NCrunch workspace.

You might be able to get this working by adding obj\gitversion.json to NCrunch's additional files to include setting.

Otherwise, I would recommend taking a look at the GitVersion.MsBuild.targets file for more information on which properties may be used to suppress its behaviour.
Remco wrote:
You might be able to get this working by adding obj\gitversion.json to NCrunch's additional files to include setting.


Let me clarify. I believe that GitVersion is _generating_ that file, not looking for it. The error is that its a malformed path (that part is the GitVersion problem).

Correction: on further investigation it's because it can't find the Git repository. I guess I could have NCrunch include the .git directory but what would be even better if to be able to prevent the task from running, like it used to be with GitVersion.Task.

-Tim

Edited

Tim Long wrote:
Let me clarify. I believe that GitVersion is _generating_ that file, not looking for it. The error is that its a malformed path (that part is the GitVersion problem).


Understood. In this case, it may be enough to simply create an empty text file inside the 'obj' directory, then include this file in NCrunch's additional files to include setting. This will force NCrunch to create the directory inside the workspace, hopefully allowing the task to run without problems.

Tim Long wrote:
What I see as potentially an NCrunch problem is that I can't prevent it from running by setting IgnoreGitVersionTask=True like I used to be able to.


Presently, NCrunch has no build integration with this git package. This means that any configuration settings used to suppress the package are specific to the package itself and are not under our control. Usually, a quick look at the targets inside the package can reveal a way to suppress the targets.
Tim Long wrote:
Correction: on further investigation it's because it can't find the Git repository. I guess I could have NCrunch include the .git directory but what would be even better if to be able to prevent the task from running, like it used to be with GitVersion.Task.


From the NCrunch side, all we really do is pass properties into the build. From there, it's up to the package as to how it deals with these properties.

I've just done a quick review of this package. It looks to be quite new, with only around 600 downloads. The mechanism it uses to disable itself seems to work through a chain of properties that appears quite complicated and I'm not entirely sure whether it works correctly. It's quite possible that your intended off switch just won't work on this package. I would recommend including the 'obj' directory or trying a different system/package.
I got my build to work by including the .git folder. It's not ideal but its good enough :)

Post a reply

Log in to reply.