Skip to content

TFS GitVersion Task 5.0.1 does not use GitVersion.yml by default #1867

@roryprimrose

Description

@roryprimrose

I have installed the GitVersion build task on a TFS 2018 R2 instance then ran it against a repo that contains a GitVersion.yml in the repo root.

mode: ContinuousDeployment
branches:
  master:
    tag: beta
  hotfix:
    tag: useBranchName

The task config (exported) looks like this:

   {
      "displayName": "GitVersion",
      "alwaysRun": false,
      "continueOnError": false,
      "condition": "succeeded()",
      "enabled": true,
      "timeoutInMinutes": 0,
      "inputs": {
        "runtime": "core",
        "preferBundledVersion": "true",
        "configFilePath": "",
        "updateAssemblyInfo": "false",
        "updateAssemblyInfoFilename": "",
        "gitVersionPath": "",
        "targetPath": "",
        "additionalArguments": ""
      },
      "task": {
        "id": "e5383830-3f75-11e5-82ed-81492570a08e",
        "versionSpec": "5.*",
        "definitionType": "task"
      }
    },

Running the task without the config path set will generate the wrong pre-release tags. The master branch would not contain a prerelease tag, hotfix would use beta which is the default OOTB config.

Seems like the default loading of GitVersion.yml isn't happening. The code for the task looks fine so I'm assuming it is an issue with the GitVersionCore logic.

The workaround is to specifically set the config path property on the task to GitVersion.yml. The build now picks up the config and assigns the correct prerelease tags. For example:

   {
      "displayName": "GitVersion",
      "alwaysRun": false,
      "continueOnError": false,
      "condition": "succeeded()",
      "enabled": true,
      "timeoutInMinutes": 0,
      "inputs": {
        "runtime": "core",
        "preferBundledVersion": "true",
        "configFilePath": "GitVersion.yml",
        "updateAssemblyInfo": "false",
        "updateAssemblyInfoFilename": "",
        "gitVersionPath": "",
        "targetPath": "",
        "additionalArguments": ""
      },
      "task": {
        "id": "e5383830-3f75-11e5-82ed-81492570a08e",
        "versionSpec": "5.*",
        "definitionType": "task"
      }
    },

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions