diff --git a/docs/build-server-support/build-server/azure-devops b/docs/build-server-support/build-server/azure-devops index 4bd4a5a2c1..bdbe040e4f 100644 --- a/docs/build-server-support/build-server/azure-devops +++ b/docs/build-server-support/build-server/azure-devops @@ -38,6 +38,35 @@ If you want the GitVersionTask to update AssemblyInfo files, check the box in th The Azure DevOps Pipeline build step can update your build number with GitVersion variables. See below for details. +#### Using Pipelines yaml + +Add the following yaml task and variable to your `azure-pipelines.yml` file: + +```yml +variables: + GitVersion.SemVer: '' + +steps: +- task: gittools.gitversion.gitversion-task.GitVersion@5 + displayName: gitversion + inputs: + useConfigFile: true + configFilePath: GitVersion.yml +``` + +You can now use the `GitVersion.SemVer` environment variable in any subsequent tasks to refer to the semantic version number for your build. For example, you can build your dotnet core application with a semantic version number like so: + +```yml +- task: DotNetCoreCLI@2 + displayName: Build + inputs: + command: build + projects: '$(solution)' + configuration: '$(buildConfiguration)' + versioningScheme: byEnvVar + versionEnvVar: 'GitVersion.SemVer' + +``` ## Running inside TFS ### Using the GitVersion Variables