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/msbuild-task.md
+23-1Lines changed: 23 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,8 @@ The MSBuild Task for GitVersion — **GitVersionTask** — is a simple solution
4
4
you want to version your assemblies without writing any command line scripts or
5
5
modifying your build process.
6
6
7
+
It currently works with desktop `MSBuild`. Support for CoreCLR with `dotnet build` is coming soon.
8
+
7
9
## TL;DR
8
10
9
11
### Install the MSTask targets
@@ -16,6 +18,14 @@ From the Package Manager Console:
16
18
Install-Package GitVersionTask
17
19
```
18
20
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:
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
115
125
are prefixed with `GitVersion_`. This prevents conflicts with other properties
116
126
in the pipeline.
117
127
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
+
118
139
#### Accessing variables in MSBuild
119
140
120
141
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
136
157
137
158
## Conditional control tasks
138
159
139
-
Properties `WriteVersionInfoToBuildLog`, `UpdateAssemblyInfo` and `GetVersion`
160
+
Properties `WriteVersionInfoToBuildLog`, `UpdateAssemblyInfo`, `UseFullSemVerForNuGet`, `UpdateVersionProperties` and `GetVersion`
140
161
are checked before running these tasks.
141
162
142
163
You can disable `GitVersionTask.UpdateAssemblyInfo` by setting
@@ -150,6 +171,7 @@ this:
150
171
...
151
172
</PropertyGroup>
152
173
```
174
+
For SDK-style projects, `UpdateVersionProperties` controls setting the default variables: `Version`, `VersionPrefix`, `VersionSuffix`, `PackageVersion`, `InformationalVersion`, `AssemblyVersion` and `FileVersion`.
153
175
154
176
## My Git repository requires authentication. What should I do?
0 commit comments