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
Copy file name to clipboardExpand all lines: docs/usage/command-line.md
+22-8Lines changed: 22 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -1,21 +1,35 @@
1
1
# Command Line
2
2
3
-
If you want a command line version installed on your machine then you can use [Chocolatey](http://chocolatey.org) to install GitVersion
3
+
If you want a command line version installed on your machine then you can use [Chocolatey](http://chocolatey.org)or [Homebrew](https://brew.sh/)to install GitVersion.
4
4
5
-
Available on [Chocolatey](http://chocolatey.org) under [GitVersion.Portable](http://chocolatey.org/packages/GitVersion.Portable)
5
+
## Chocolatey
6
6
7
-
> choco install GitVersion.Portable
7
+
Available on [Chocolatey](http://chocolatey.org) under [GitVersion.Portable](http://chocolatey.org/packages/GitVersion.Portable).
8
+
9
+
```shell
10
+
choco install GitVersion.Portable
11
+
```
8
12
9
13
Switches are available with `GitVersion /?`
10
14
15
+
## Homebrew
16
+
17
+
To install GitVersion with [Homebrew](https://brew.sh/), type:
18
+
19
+
```shell
20
+
brew install gitversion
21
+
```
22
+
23
+
Switches are available with `gitversion --help`. Even though the documentation uses a slash `/` for all switches, you need to use a dash `-` instead, since `/` is interpreted as a root path on POSIX based operating systems.
24
+
11
25
## Output
12
26
13
27
By default GitVersion returns a json object to stdout containing all the [variables](../more-info/variables.md) which GitVersion generates. This works great if you want to get your build scripts to parse the json object then use the variables, but there is a simpler way.
14
28
15
29
`GitVersion.exe /output buildserver` will change the mode of GitVersion to write out the variables to whatever build server it is running in. You can then use those variables in your build scripts or run different tools to create versioned NuGet packages or whatever you would like to do. See [build servers](../build-server-support/build-server-support.md) for more information about this.
16
30
17
31
## Inject version metadata into the assembly
18
-
`GitVersion.exe /updateassemblyinfo` will recursively search for all `AssemblyInfo.cs` or `AssemblyInfo.vb` files in the git repo and update them.
32
+
`GitVersion.exe /updateassemblyinfo` will recursively search for all `AssemblyInfo.cs` or `AssemblyInfo.vb` files in the git repo and update them.
19
33
It will update the following assembly attributes:
20
34
21
35
*`AssemblyVersion` will be set to the `AssemblySemVer` variable.
@@ -24,15 +38,15 @@ It will update the following assembly attributes:
24
38
25
39
Note that contrary to when using the [MSBuild Task](msbuild-task.md) the attributes must already exist in the `AssemblyInfo.cs` or `AssemblyInfo.vb` files prior to calling GitVersion.
26
40
27
-
By adding `/updateassemblyinfo <filenames>` the name of AssemblyInfo file to update can be set. This switch can accept multiple files with the path to the file specified relative to the working directory.
41
+
By adding `/updateassemblyinfo <filenames>` the name of AssemblyInfo file to update can be set. This switch can accept multiple files with the path to the file specified relative to the working directory.
28
42
29
43
GitVersion can generate an assembly info source file for you if it does not already exist. Use the `/ensureassemblyinfo` switch alongside `/updateassemblyinfo <filename>`, if the filename specified does not exist it will be generated based on a known template that adds:
30
44
31
45
*`AssemblyVersion` will be set to the `AssemblySemVer` variable.
32
46
*`AssemblyFileVersion` will be set to the `MajorMinorPatch` variable with a appended `.0`.
33
47
*`AssemblyInformationalVersion` will be set to the `InformationalVersion` variable.
34
48
35
-
This can be done for *.cs, *.vb and *.fs files.
49
+
This can be done for *.cs, *.vb and *.fs files.
36
50
37
51
When requesting that GitVersion generate an assembly info file you are limited to only specifying a single `<filename>` within the `/updateassemblyinfo` switch, this is to prevent the creation of mulitple assembly info files with the same assembly version attributes. If this occurs your build will fail.
38
52
@@ -57,7 +71,7 @@ Will result in command line argument error
57
71
Will iterate through each file and update known attributes (`AssemblyVersion`, `AssemblyFileVersion`, `AssemblyInformationalVersion`).
58
72
59
73
## Override config
60
-
`/overrideconfig [key=value]` will override appropriate key from 'GitVersion.yml'.
74
+
`/overrideconfig [key=value]` will override appropriate key from 'GitVersion.yml'.
61
75
62
76
At the moment only `tag-prefix` option is supported. Read more about [Configuration](/configuration/).
63
77
@@ -67,4 +81,4 @@ It will not change config file 'GitVersion.yml'.
0 commit comments