Now that the 4.0.0 version of GitVersion has been published to the Marketplace I've been trying to use it in my projects, but unfortunately I'm getting an error when using the 4.0 version of the build task:
2018-10-14T17:50:43.3560348Z ##[error]File not found: 'D:\a\_tasks\GitVersion_e5983830-3f75-11e5-82ed-81492570a08e\4.0.0\GitVersion.js'
This looks like a packaging issue with the VSTS extension. Looks like the build task is written in TypeScript, so I'm guessing that the TypeScript wasn't transpiled to JavaScript at the time of the release. I believe @arturcic published the 4.0.0 version of the VSTS task as a part of #1445.
Actually the GitVersion.js is there, I guess the task is not looking at the correct location

Hmm, looking at the task.json it's looking for the GitVersion.js in the root, but looking at the screenshot it is inside of a scripts folder. So I guess the task.json should be modified to match the actual path of the GitVersion.js. I can submit a PR to fix this, but I don't think I'll be able to release it, right?
Same error on an Ubuntu VSTS build agent.

It's a private agent so I was able to look into the task folder's content:

no scripts folder, no transpiled GitVersion.js.
@jmezach, @yohanb, I have updated task.json with the scripts/GitVersion.js path and uploaded the version with the fix. Can you try the latest version and see if this fixes your issue?
@arturcic I just tried it, but I'm still getting the same error. Since the error also contains the version number, which is still 4.0.0, I'm wondering if the version number on the task has been updated. If not I believe that VSTS will still use the old version (due to caching).
Ok then, I'll update that as well
@jmezach Updated, moved the files to the same location as task.json, can you try the new version?
Okay, it picked up the new version of the task now, but now I'm getting a different error:
2018-10-15T07:02:45.7987690Z ##[section]Starting: GitVersion
2018-10-15T07:02:45.7991420Z ==============================================================================
2018-10-15T07:02:45.7991620Z Task : GitVersion Task
2018-10-15T07:02:45.7991730Z Description : Easy Semantic Versioning (http://semver.org) for projects using Git
2018-10-15T07:02:45.7991850Z Version : 4.0.1
2018-10-15T07:02:45.7992010Z Author : GitVersion Contributors
2018-10-15T07:02:45.7992190Z Help : See the [documentation](http://gitversion.readthedocs.org/en/latest/) for help
2018-10-15T07:02:45.7992310Z ==============================================================================
2018-10-15T07:02:46.3209380Z module.js:471
2018-10-15T07:02:46.3218320Z throw err;
2018-10-15T07:02:46.3218580Z ^
2018-10-15T07:02:46.3218700Z
2018-10-15T07:02:46.3219900Z Error: Cannot find module 'vsts-task-lib/task'
2018-10-15T07:02:46.3220270Z at Function.Module._resolveFilename (module.js:469:15)
2018-10-15T07:02:46.3220560Z at Function.Module._load (module.js:417:25)
2018-10-15T07:02:46.3220900Z at Module.require (module.js:497:17)
2018-10-15T07:02:46.3221060Z at require (internal/module.js:20:19)
2018-10-15T07:02:46.3221860Z at Object.<anonymous> (/Users/vsts/agent/2.140.2/work/_tasks/GitVersion_e5983830-3f75-11e5-82ed-81492570a08e/4.0.1/GitVersion.js:11:12)
2018-10-15T07:02:46.3222470Z at Module._compile (module.js:570:32)
2018-10-15T07:02:46.3222700Z at Object.Module._extensions..js (module.js:579:10)
2018-10-15T07:02:46.3222860Z at Module.load (module.js:487:32)
2018-10-15T07:02:46.3223090Z at tryModuleLoad (module.js:446:12)
2018-10-15T07:02:46.3224580Z at Function.Module._load (module.js:438:3)
2018-10-15T07:02:46.3889420Z ##[error]Exit code 1 returned from process: file name '/Users/vsts/agent/2.140.2/externals/node/bin/node', arguments '"/Users/vsts/agent/2.140.2/work/_tasks/GitVersion_e5983830-3f75-11e5-82ed-81492570a08e/4.0.1/GitVersion.js"'.
2018-10-15T07:02:46.3926680Z ##[section]Finishing: GitVersion
Are the node_modules part of the VSIX?
looks like we need to include the node_modules as well
@jmezach can you try the new version? this one included node_modules
Okay, so it looks like it's working now, at least on Windows. It still fails on macOS and Linux though. Not entirely sure if that is supported at all. I thought it was, but I guess it's not, but I should probably open a separate issue for that.
For unix you need mono installed
I'll create a PR for this issue with the changes I've done so far, and I'll close the issue.
Sounds good. I'll file another issue for the macOS and Linux failures.
@yohanb , can you check the new version on your agent, I guess you have mono installed there.
@arturcic why is mono required if it's compiled as .NET Core?
The version that is used in the VSTS package is a .NET Framework package - il-merged. That was the way it was packaged before v.4.0.0, and I did not changed that, so it's still running with mono. Probably we might consider using the .NET core version, but that will add a dependency on .net core to be installed, now it's on mono
When will this be released?
a PR for this change is welcomed.
Perhaps this is also the reason for #1497. I guess taking a dependency on .NET Core isn't that weird, since the hosted agents on VSTS (including Windows, macOS and Linux) all have .NET Core SDK's installed.