You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In [Visual Studio Online](https://www.visualstudio.com/) build vNext (the web based build system) you can call GitVersion either using the Command Line build step or install a custom build step. This requires a one-time setup to import the GitVersion task into your VSO instance.
3
+
In Team Foundation Build (the web based build system) you can call GitVersion either using the Command Line build step or install a custom build step. The custom build step requires a one-time setup to import the GitVersion task into your TFS or VSO instance.
4
4
5
5
## Executing GitVersion
6
6
### Using GitVersion with the MSBuild Task NuGet Package
7
-
1. Add the [GitVersionTask](https://www.nuget.org/packages/GitVersionTask/) NuGet Package to your projects.
7
+
1. Add the [GitVersionTask](https://www.nuget.org/packages/GitVersionTask/) NuGet package to your projects.
8
8
9
9
See [MSBuild Task](/usage/#msbuild-task) for further instructions how to use the MS Build Task.
10
10
@@ -16,25 +16,28 @@ See [MSBuild Task](/usage/#msbuild-task) for further instructions how to use the
16
16
5. If you want the GitVersionTask to update AssemblyInfo files add `updateAssemblyInfo true` to the Arguments parameter.
17
17
18
18
### Using the custom GitVersion build step
19
-
#### Installing/updating the VSO Build Step
20
-
1. Install the `tfx` command line tool as shown [here](https://github.com/Microsoft/tfs-cli/blob/master/docs/buildtasks.md).
21
-
2. Download the GitVersion VSO build task from the latest release on the [GitVersion releases page](https://github.com/GitTools/GitVersion/releases) and unzip.
22
-
3. Run `tfx login` if you haven't yet, make sure to use `https://<server>.visualstudio.com/DefaultCollection` as the URL and provide a personal access token.
23
-
4. From the directory outside of where you unzipped the task, run `tfx build tasks upload .\GitVersionVsoTask` where GitVersionVsoTask is the directory containing the files.
24
-
5. It should successfully install.
19
+
#### Installing/updating the custom build step
20
+
1. Install the `tfx` command line tool as shown [here](https://github.com/Microsoft/tfs-cli/blob/master/README.md#install).
21
+
2. For TFS 2015 On-Prem configure Basic Authentication in TFS as shown [here](https://github.com/Microsoft/tfs-cli/blob/master/docs/configureBasicAuth.md).
22
+
3. Download the GitVersion TFS build task from the latest release on the [GitVersion releases page](https://github.com/GitTools/GitVersion/releases) and unzip.
23
+
4. Run `tfx login` as shown [here](https://github.com/Microsoft/tfs-cli/blob/master/README.md#login).
24
+
5. From the directory outside of where you unzipped the task, run `tfx build tasks upload .\GitVersionTfsTask --overwrite` where GitVersionTfsTask is the directory containing the files.
25
+
6. It should successfully install.
25
26
26
-
#### Using the GitVersion VSO Build Step
27
-
From a VSO vNext build definition, select "Add a Step" and then in the Build category, choose GitVersion and click Add. You'll probably want to drag the task to be at or near the top to ensure it executes before your other build steps.
27
+
#### Using the GitVersion custom build step
28
+
From a TFS build definition, select "Add a Step" and then in the Build category, choose GitVersion and click Add. You'll probably want to drag the task to be at or near the top to ensure it executes before your other build steps.
28
29
29
30
If you want the GitVersionTask to update AssemblyInfo files, check the box in the task configuration. For advanced usage, you can pass additional options to the GitVersion exe in the Additional arguments section.
30
31
31
-
## Running inside Visual Studio Online
32
+
## Running inside TFS
32
33
### Using the GitVersion Variables
33
34
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.
34
35
See [Variables](/more-info/variables/) for an overview of available variables.
35
36
36
37
#### Known limitations
37
-
* Due to [current limitations in VSO](https://github.com/Microsoft/vso-agent-tasks/issues/380) it's currently not possible to set the build version inside of VSO to one of the `GITVERSION_*` variables.
38
+
* Due to [current limitations in TFS](https://github.com/Microsoft/vso-agent-tasks/issues/380) it's currently not possible to automatically set the TFS build name to the version detected by GitVersion.
39
+
* Due to a know limitation in TFS 2015 On-Prem it's currently not possible to use variables added during build in inputs of subsequent build tasks, since the variables are processed at the beginning of the build.
40
+
As a workaround environment variables can be used in custom scripts.
38
41
39
-
## Create a NuGet package in VSO
42
+
## Create a NuGet package in TFS
40
43
If you use a Command Line task to build your NuPkg, use `%GITVERSION_NUGETVERSION%` as the version parameter: `nuget.exe pack path\to\my.nuspec -version %GITVERSION_NUGETVERSION%`
0 commit comments