Skip to content

Commit 41e0152

Browse files
dazinatorarturcic
authored andcommitted
Update azure-devops
1 parent 35cee3f commit 41e0152

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

docs/build-server-support/build-server/azure-devops

+18-1
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,12 @@ The Azure DevOps Pipeline build step can update your build number with GitVersio
4040

4141
#### Using Pipelines yaml
4242

43-
Add the following yaml task to your `azure-pipelines.yml` file:
43+
Add the following yaml task and variable to your `azure-pipelines.yml` file:
4444

4545
```yml
46+
variables:
47+
GitVersion.SemVer: ''
48+
4649
steps:
4750
- task: gittools.gitversion.gitversion-task.GitVersion@5
4851
displayName: gitversion
@@ -51,6 +54,20 @@ steps:
5154
configFilePath: GitVersion.yml
5255
```
5356

57+
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:
58+
59+
```yml
60+
- task: DotNetCoreCLI@2
61+
displayName: Build
62+
inputs:
63+
command: build
64+
projects: '$(solution)'
65+
configuration: '$(buildConfiguration)'
66+
versioningScheme: byEnvVar
67+
versionEnvVar: 'GitVersion.SemVer'
68+
69+
```
70+
5471
## Running inside TFS
5572
### Using the GitVersion Variables
5673
GitVersion passes variables in the form of `GitVersion.*` (Eg: `GitVersion.Major`) to TFS Build and also writes `GITVERSION.*` (Eg: `GITVERSION.MAJOR`) environment variables that are available for any subsequent build step.

0 commit comments

Comments
 (0)