Skip to content

Commit bcfafc4

Browse files
author
Oren Novotny
committed
add docs
1 parent 7d3c1f7 commit bcfafc4

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

docs/usage/msbuild-task.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ The MSBuild Task for GitVersion — **GitVersionTask** — is a simple solution
44
you want to version your assemblies without writing any command line scripts or
55
modifying your build process.
66

7+
It currently works with desktop `MSBuild`. Support for CoreCLR with `dotnet build` is coming soon.
8+
79
## TL;DR
810

911
### Install the MSTask targets
@@ -16,6 +18,14 @@ From the Package Manager Console:
1618
Install-Package GitVersionTask
1719
```
1820

21+
If you're using `PackageReference` style NuGet dependencies (VS 2017+), add `<PrivateAssets>all</PrivateAssets>` to prevent the task from becoming a dependency of your package:
22+
23+
``` xml
24+
<PackageReference Include="GitVersionTask" Version="4.0.0-beta*">
25+
<PrivateAssets>All</PrivateAssets>
26+
</PackageReference>
27+
```
28+
1929
### Remove AssemblyInfo attributes
2030

2131
The next thing you need to do is to remove the `Assembly*Version` attributes from
@@ -115,6 +125,17 @@ However at MSBuild time these properties are mapped to MSBuild properties that
115125
are prefixed with `GitVersion_`. This prevents conflicts with other properties
116126
in the pipeline.
117127

128+
In addition, the following MSBuild properties are set when `UpdateVersionProperties` is true (the default):
129+
`Version`, `VersionPrefix`, `VersionSuffix`, `PackageVersion`, `InformationalVersion`, `AssemblyVersion` and `FileVersion`. These are used by the built-in tasks for generating AssemblyInfo's and NuGet package versions.
130+
131+
132+
### NuGet packages
133+
The new SDK-style projects available for .NET Standard libraries (and multi-targeting), have the ability
134+
to create NuGet packages directly by using the `pack` target: `msbuild /t:pack`. The version is controled by the MSBuild properties described above.
135+
136+
GitVersionTask has the option to generate SemVer 2.0 compliant NuGet package versions by setting `UseFullSemVerForNuGet` to true in your project (this is off by default for compatibility). Some hosts, like MyGet, support SemVer 2.0 package versions but older NuGet clients and nuget.org do not.
137+
138+
118139
#### Accessing variables in MSBuild
119140

120141
Once `GitVersionTask.GetVersion` has been executed, the MSBuild properties can be
@@ -136,7 +157,7 @@ Build Server log in a format that the current Build Server can consume. See
136157

137158
## Conditional control tasks
138159

139-
Properties `WriteVersionInfoToBuildLog`, `UpdateAssemblyInfo` and `GetVersion`
160+
Properties `WriteVersionInfoToBuildLog`, `UpdateAssemblyInfo`, `UseFullSemVerForNuGet`, `UpdateVersionProperties` and `GetVersion`
140161
are checked before running these tasks.
141162

142163
You can disable `GitVersionTask.UpdateAssemblyInfo` by setting
@@ -150,6 +171,7 @@ this:
150171
...
151172
</PropertyGroup>
152173
```
174+
For SDK-style projects, `UpdateVersionProperties` controls setting the default variables: `Version`, `VersionPrefix`, `VersionSuffix`, `PackageVersion`, `InformationalVersion`, `AssemblyVersion` and `FileVersion`.
153175

154176
## My Git repository requires authentication. What should I do?
155177

0 commit comments

Comments
 (0)