diff --git a/src/GitVersionTfsTask/GitVersion.ts b/src/GitVersionTfsTask/GitVersion.ts index bd5b129df5..677195db21 100644 --- a/src/GitVersionTfsTask/GitVersion.ts +++ b/src/GitVersionTfsTask/GitVersion.ts @@ -8,11 +8,14 @@ var updateAssemblyInfo = tl.getBoolInput('updateAssemblyInfo'); var updateAssemblyInfoFilename = tl.getInput('updateAssemblyInfoFilename'); var additionalArguments = tl.getInput('additionalArguments'); var gitVersionPath = tl.getInput('gitVersionPath'); +var targetPath = tl.getInput('targetPath'); var preferBundledVersion = tl.getBoolInput('preferBundledVersion'); var currentDirectory = __dirname; -var sourcesDirectory = tl.getVariable("Build.SourcesDirectory") +var workingDirectory = !targetPath + ? tl.getVariable("Build.SourcesDirectory") + : path.join(tl.getVariable("Build.SourcesDirectory"), targetPath); if (!gitVersionPath) { gitVersionPath = tl.which("GitVersion.exe"); @@ -47,7 +50,7 @@ if (!gitVersionPath) { } toolRunner.arg([ - sourcesDirectory, + workingDirectory, "/output", "buildserver", "/nofetch" diff --git a/src/GitVersionTfsTask/task.json b/src/GitVersionTfsTask/task.json index 58f8c6b6b4..24262a07a1 100644 --- a/src/GitVersionTfsTask/task.json +++ b/src/GitVersionTfsTask/task.json @@ -57,6 +57,15 @@ "helpMarkDown": "Optionally supply the path to GitVersion.exe", "groupName": "additional" }, + { + "name": "targetPath", + "type": "string", + "label": "Working directory path", + "defaultValue": "", + "required": false, + "helpMarkDown": "Optionally supply the path to the working directory", + "groupName": "additional" + }, { "name": "preferBundledVersion", "type": "boolean",