Skip to content

Commit 5562db8

Browse files
committed
re #630 - Updates docs to reflect new scenerios for /updateassemblyinfo and /ensureassemblyinfo
1 parent af904eb commit 5562db8

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

docs/usage/command-line.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,34 @@ It will update the following assembly attributes:
2424

2525
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.
2626

27-
By adding `/updateassemblyinfofilename` the name of AssemblyInfo file to update can be set.
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.
28+
29+
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+
31+
* `AssemblyVersion` will be set to the `AssemblySemVer` variable.
32+
* `AssemblyFileVersion` will be set to the `MajorMinorPatch` variable with a appended `.0`.
33+
* `AssemblyInformationalVersion` will be set to the `InformationalVersion` variable.
34+
35+
This can be done for *.cs, *.vb and *.fs files.
36+
37+
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+
39+
### Example: When AssemblyInfo.cs does not exist
40+
`GitVersion.exe /updateassemblyinfo AssemblyInfo.cs /ensureassemblyinfo`
41+
42+
A file is generated that contains version attributes (`AssemblyVersion`, `AssemblyFileVersion`, `AssemblyInformationalVersion`)
43+
44+
### Example: When AssemblyInfo.cs already exists
45+
`GitVersion.exe /updateassemblyinfo AssemblyInfo.cs /ensureassemblyinfo`
46+
47+
All known attributes (`AssemblyVersion`, `AssemblyFileVersion`, `AssemblyInformationalVersion`) will be updated
48+
49+
### Example: When AssemblyInfo.cs and AssemblyVersionInfo.cs do not exist
50+
`GitVersion.exe /updateassemblyinfo AssemblyInfo.cs AssemblyVersionInfo.cs /ensureassemblyinfo`
51+
52+
Will result in command line argument error
53+
54+
### Example: When AssemblyInfo.cs and AssemblyVersionInfo.cs already exist
55+
`GitVersion.exe /updateassemblyinfo AssemblyInfo.cs AssemblyVersionInfo.cs`
56+
57+
Will iterate through each file and update known attributes (`AssemblyVersion`, `AssemblyFileVersion`, `AssemblyInformationalVersion`).

0 commit comments

Comments
 (0)