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
You must also create [a version.json file](doc/versionJson.md) in your repo. See [migration notes](doc/migrating.md) if your repo already has a version.txt or version.json file from using another system.
35
-
36
-
## How to leverage version stamping and runtime information
37
-
38
-
See relevant documentation for any of these topics:
39
-
40
-
*[.NET](doc/dotnet.md)
41
-
*[Node](doc/node.md)
42
-
*[VSIX](doc/vsix.md)
43
-
*[NuProj](doc/nuproj.md)
44
-
45
-
## Build
46
-
47
-
We have docs to describe how to build with Nerdbank.GitVersioning
48
-
for these build systems:
49
-
50
-
*[MSBuild](doc/msbuild.md)
51
-
*[gulp](doc/gulp.md)
52
-
*[DNX](doc/dotnet-cli.md)
53
-
*[dotnet CLI](doc/dotnet-cli.md)
54
-
*[Cake Build](doc/cake.md)
55
-
56
-
Also some special [cloud build considerations](doc/cloudbuild.md) (e.g. Azure Pipelines, GitHub Actions, etc.).
57
-
58
-
## Where and how versions are calculated and applied
59
-
60
-
This package calculates the version based on a combination of the version.json file,
61
-
the git 'height' of the version, and the git commit ID.
62
-
The height can optionally be incremented only for those [commits that change certain paths](doc/pathFilters.md).
63
-
64
-
### Version generation
65
-
66
-
Given the same settings as used in the discussion above, a NuGet or NPM package may be
67
-
assigned this version:
68
-
69
-
1.0.24-alpha-g9a7eb6c819
70
-
71
-
When built as a public release, the git commit ID is dropped:
72
-
73
-
1.0.24-alpha
74
-
75
-
Learn more about [public releases versus prereleases](doc/public_vs_stable.md).
76
-
77
-
## Frequently asked questions
78
-
79
-
### What is 'git height'?
80
-
81
-
Git 'height' is the number of commits in the longest path from HEAD (the code you're building)
82
-
to some origin point, inclusive. In this case the origin is the commit that set the major.minor
83
-
version number to the values found in HEAD.
84
-
85
-
For example, if the version specified at HEAD is 3.4 and the longest path in git history from HEAD
86
-
to where the version file was changed to 3.4 includes 15 commits, then the git height is "15".
87
-
Another example is when HEAD points directly at the commit that changed the major.minor version,
88
-
which has a git height of 1. [Learn more about 1 being the minimum revision number][GitHeightMinimum].
89
-
90
-
### Why is the git height used for the PATCH version component for public releases?
91
-
92
-
The git commit ID does not represent an alphanumerically sortable identifier
93
-
in semver, and thus delivers a poor package update experience for NuGet package
94
-
consumers. Incrementing the PATCH with each public release ensures that users
95
-
who want to update to your latest NuGet package will reliably get the latest
96
-
version.
97
-
98
-
The git height is guaranteed to always increase with each release within a given major.minor version,
99
-
assuming that each release builds on a previous release. And the height automatically resets when
100
-
the major or minor version numbers are incremented, which is also typically what you want.
101
-
102
-
### Why isn't the git commit ID included for public releases?
103
-
104
-
It could be, but the git height serves as a pseudo-identifier already and the
105
-
git commit id would just make it harder for users to type in the version
106
-
number if they ever had to.
107
-
108
-
Note that the git commit ID is *always* included in the
109
-
`AssemblyInformationalVersionAttribute` so one can always match a binary to the
110
-
exact version of source code that produced it.
111
-
112
-
Learn more about [public releases and the git commit ID suffix](doc/public_vs_stable.md).
113
-
114
-
### How do I translate from a version to a git commit and vice versa?
115
-
116
-
While Nerdbank.GitVersioning calculates the version and applies it to most builds automatically,
117
-
there can be occasions where you want to do so yourself or reverse the process to determine
118
-
the commit that produced a given version.
119
-
120
-
To do this use [the `nbgv` tool](doc/nbgv-cli.md) with the `get-version` or `get-commits` command.
121
-
122
-
Another (deprecated) option is to use a pair of Powershell scripts are included in the Nerdbank.GitVersioning NuGet package
123
-
that can help you to translate between the two representations.
124
-
125
-
tools\Get-CommitId.ps1
126
-
tools\Get-Version.ps1
127
-
128
-
`Get-CommitId.ps1` takes a version and print out the matching commit (or possible commits, in the exceptionally rare event of a collision).
129
-
`Get-Version.ps1` prints out the version information for the git commit current at HEAD.
130
-
131
-
### How do I build Nerdbank.GitVersioning from source?
132
-
133
-
Prerequisites and build instructions are found in our
134
-
[contributing guidelines](CONTRIBUTING.md).
135
-
136
-
### How do I consume the latest changes prior to their release on nuget.org?
137
-
138
-
We have [a public feed][PublicCI] where our CI pushes packages.
139
-
Adding the feed source URL to your nuget.config file will allow you to consume package versions that haven't been publicly released to nuget.org yet.
25
+
Check out our [getting started documentation](https://dotnet.github.io/Nerdbank.GitVersioning/docs/getting-started.html).
140
26
141
27
## Code of Conduct
142
28
@@ -145,4 +31,3 @@ For more information see the [.NET Foundation Code of Conduct](https://dotnetfou
Copy file name to clipboardExpand all lines: docfx/docs/build-systems/msbuild.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# MSBuild
1
+
# MSBuild / `dotnet build`
2
2
3
3
Installing the `Nerdbank.GitVersioning` package from NuGet into your MSBuild-based projects is the recommended way to add version information to your MSBuild project outputs including assemblies, native dll's, and packages.
4
4
@@ -168,7 +168,7 @@ If you still see many invocations, you may have a build that sets global propert
168
168
Investigate this using the MSBuild `/bl` switch and view the log with the excellent [MSBuild Structured Log Viewer](https://msbuildlog.com) tool.
169
169
Using that tool, search for `$task GetBuildVersion` and look at the global properties passed to the special `Nerdbank.GitVersioning.Inner.targets` project, as shown:
0 commit comments