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 add GitVersion as a Build Step. This requires a one-time setup to import the GitVersion task into your VSO instance.
4
+
5
+
## Installing/updating the VSO Build Step
6
+
1. Install the `tfx` command line tool as shown [here](https://github.com/Microsoft/tfs-cli/blob/master/docs/buildtasks.md)
7
+
2. Download the GitVersion VSO extension from the latest release on the [GitVersion releases page](https://github.com/GitTools/GitVersion/releases) and unzip.
8
+
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
9
+
4. From the directory outside of where you unzipped the task, run `tfx upload .\GitVersionVsoTask` where GitVersionVsoTask is the directory containing the files.
10
+
5. It should successfully install
11
+
12
+
## Using the GitVersion VSO Build Step
13
+
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.
14
+
15
+
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.
16
+
17
+
## Using the GitVersion Variables
18
+
GitVersion writes build parameters into VSO, so they will automatically be passed to your build scripts to use. It also writes GITVERSION_* environment variables that are available for any subsequent build step.
19
+
20
+
Note that 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.
21
+
22
+
## Running inside Visual Studio Online
23
+
* We output the individual values of the GitVersion version as the build parameter: `GitVersion.*` (Eg: `GitVersion.Major`) if you need access to them in your build script
24
+
25
+
### NuGet in VSO
26
+
* If you use a command script to build your NuPkg, use `%GITVERSION_NUGETVERSION%` as the version parameter: `nuget.exe pack path\to\my.nuspec -version %GITVERSION_NUGETVERSION%`
0 commit comments