Skip to content

Commit 7b86ca1

Browse files
authored
Merge pull request #1139 from dotnet/docs
Migrate all docs to docfx
2 parents 695362b + e5f6fd4 commit 7b86ca1

34 files changed

+239
-225
lines changed

README.md

+1-116
Original file line numberDiff line numberDiff line change
@@ -22,121 +22,7 @@ What sets this package apart from other git-based versioning projects is:
2222
4. The computed version information is based on an author-defined major.minor version and an optional unstable tag, plus a shortened git commit ID.
2323
5. This project is supported by the [.NET Foundation](https://dotnetfoundation.org).
2424

25-
## Installation and Configuration
26-
27-
You can install Nerdbank.GitVersioning into your projects via NuGet or NPM.
28-
29-
* Use the [nbgv .NET Core CLI tool](doc/nbgv-cli.md) (recommended)
30-
* [NuGet installation instructions](doc/nuget-acquisition.md)
31-
* [NPM installation instructions](doc/npm-acquisition.md)
32-
* [Cake Build installation instructions](doc/cake.md)
33-
34-
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).
14026

14127
## Code of Conduct
14228

@@ -145,4 +31,3 @@ For more information see the [.NET Foundation Code of Conduct](https://dotnetfou
14531

14632
[semver]: http://semver.org
14733
[GitHeightMinimum]: https://github.com/dotnet/Nerdbank.GitVersioning/issues/102#issuecomment-269591960
148-
[PublicCI]: https://dev.azure.com/andrewarnott/OSS/_packaging?_a=feed&feed=PublicCI

azure-pipelines/build.yml

+2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ jobs:
4848
displayName: 💅 Verify formatted code
4949
env:
5050
dotnetformat: true # part of a workaround for https://github.com/dotnet/sdk/issues/44951
51+
- script: dotnet docfx docfx/docfx.json --warningsAsErrors --disableGitFeatures
52+
displayName: 📚 Verify docfx build
5153

5254
- job: WrapUp
5355
dependsOn:

doc/dotnet-cli.md

-7
This file was deleted.

doc/nuproj.md

-37
This file was deleted.

docfx/docfx.json

+2-15
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,4 @@
11
{
2-
"metadata": [
3-
{
4-
"src": [
5-
{
6-
"src": "../src/Library",
7-
"files": [
8-
"**/*.csproj"
9-
]
10-
}
11-
],
12-
"dest": "api"
13-
}
14-
],
152
"build": {
163
"content": [
174
{
@@ -39,8 +26,8 @@
3926
"modern"
4027
],
4128
"globalMetadata": {
42-
"_appName": "Library",
43-
"_appTitle": "Library",
29+
"_appName": "Nerdbank.GitVersioning",
30+
"_appTitle": "Nerdbank.GitVersioning",
4431
"_enableSearch": true,
4532
"pdf": false
4633
}
File renamed without changes.
File renamed without changes.

doc/msbuild.md renamed to docfx/docs/build-systems/msbuild.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# MSBuild
1+
# MSBuild / `dotnet build`
22

33
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.
44

@@ -168,7 +168,7 @@ If you still see many invocations, you may have a build that sets global propert
168168
Investigate this using the MSBuild `/bl` switch and view the log with the excellent [MSBuild Structured Log Viewer](https://msbuildlog.com) tool.
169169
Using that tool, search for `$task GetBuildVersion` and look at the global properties passed to the special `Nerdbank.GitVersioning.Inner.targets` project, as shown:
170170

171-
[![MSBuild Structure Logger screenshot](globalproperties_log.png)
171+
[![MSBuild Structure Logger screenshot](../../images/globalproperties_log.png)
172172

173173
Compare the set of global properties for each `Nerdbank.GitVersioning.Inner.targets` project to identify which properties are unique each time.
174174
Add the names of the unique properties to the `Directory.Build.props` file:
File renamed without changes.

doc/dotnet.md renamed to docfx/docs/ecosystems/dotnet.md

+36-4
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,50 @@
1-
# .NET support
1+
# .NET
22

3-
Nerdbank.GitVersioning offers first class version stamping support for .NET assemblies.
3+
Nerdbank.GitVersioning offers first class version stamping support for .NET assemblies and NuGet packages.
4+
5+
## Hello, World! for versioning
6+
7+
The following commands demonstrate Nerdbank.GitVersioning on a new project:
8+
9+
```ps1
10+
mkdir NbgvExample
11+
cd NbgvExample
12+
git init
13+
dotnet new classlib --framework=netstandard2.0
14+
git add *.cs *.csproj
15+
git commit -m "Plain vanilla project"
16+
dotnet tool install -g nbgv
17+
nbgv install
18+
git commit -m "Add version stamping"
19+
dotnet pack
20+
dir .\bin\Release\*.nupkg
21+
```
22+
23+
This will build a package versioned 1.0.1-beta.
24+
25+
Then make a small change, commit the change, and pack again to see the version change:
26+
27+
```ps1
28+
touch README.md
29+
git add README.md
30+
git commit -m "Add README"
31+
dotnet pack
32+
dir .\bin\Release\*.nupkg
33+
```
34+
35+
Now we have another package, the new one versioned 1.0.2-beta.
436

537
## Assembly version generation
638

7-
During the build it adds source code such as this to your compilation:
39+
During the build Nerdbank.GitVersioning adds source code such as this to your compilation:
840

941
```csharp
1042
[assembly: System.Reflection.AssemblyVersion("1.0")]
1143
[assembly: System.Reflection.AssemblyFileVersion("1.0.24.15136")]
1244
[assembly: System.Reflection.AssemblyInformationalVersion("1.0.24-alpha+g9a7eb6c819")]
1345
```
1446

15-
* The first and second integer components of the versions above come from the
47+
* The first and second integer components of the versions above come from the
1648
version file.
1749
* The third integer component of the version here is the height of your git history up to
1850
that point, such that it reliably increases with each release.

doc/node.md renamed to docfx/docs/ecosystems/node.md

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
# Node support
1+
# Node.js
22

3-
## Acquisition
4-
5-
See [NPM acquisition](npm-acquisition.md).
3+
First, you should [acquire the `nerdbank-gitversioning` NPM package](../npm-acquisition.md).
64

75
## Acquiring version information
86

@@ -28,4 +26,4 @@ Will print out a JavaScript object resembling this:
2826

2927
## Build integration
3028

31-
Check out our [instructions for gulp](gulp.md).
29+
Check out our [instructions for gulp](../build-systems/gulp.md).
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# VSIX support
1+
# VSIX projects
22

33
Nerdbank.GitVersioning can automatically stamp the VSIXs you build with
4-
the version calculated from your version.json file and git height.
4+
the version calculated from your version.json file and git height.
55

66
## Installation
77

8-
1. Install the Nerdbank.GitVersioning NuGet package into your VSIX-generating project.
8+
1. [Install the Nerdbank.GitVersioning NuGet package](../nuget-acquisition.md) into your VSIX-generating project.
99
1. Open the `source.extension.vsixmanifest` file in a code editor
1010
and set the `PackageManifest/Metadata/Identity/@Version` attribute to this
1111
value: `|%CurrentProject%;GetBuildVersion|`

docfx/docs/faq.md

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Frequently asked questions
2+
3+
## What is 'git height'?
4+
5+
Git 'height' is the number of commits in the longest path from HEAD (the code you're building)
6+
to some origin point, inclusive. In this case the origin is the commit that set the major.minor
7+
version number to the values found in HEAD.
8+
9+
For example, if the version specified at HEAD is 3.4 and the longest path in git history from HEAD
10+
to where the version file was changed to 3.4 includes 15 commits, then the git height is "15".
11+
Another example is when HEAD points directly at the commit that changed the major.minor version,
12+
which has a git height of 1. [Learn more about 1 being the minimum revision number][GitHeightMinimum].
13+
14+
## Why is the git height used for the PATCH version component for public releases?
15+
16+
The git commit ID does not represent an alphanumerically sortable identifier
17+
in semver, and thus delivers a poor package update experience for NuGet package
18+
consumers. Incrementing the PATCH with each public release ensures that users
19+
who want to update to your latest NuGet package will reliably get the latest
20+
version.
21+
22+
The git height is guaranteed to always increase with each release within a given major.minor version,
23+
assuming that each release builds on a previous release. And the height automatically resets when
24+
the major or minor version numbers are incremented, which is also typically what you want.
25+
26+
## Why isn't the git commit ID included for public releases?
27+
28+
It could be, but the git height serves as a pseudo-identifier already and the
29+
git commit id would just make it harder for users to type in the version
30+
number if they ever had to.
31+
32+
Note that the git commit ID is *always* included in the
33+
`AssemblyInformationalVersionAttribute` so one can always match a binary to the
34+
exact version of source code that produced it.
35+
36+
Learn more about [public releases and the git commit ID suffix](public-vs-stable.md).
37+
38+
## How do I translate from a version to a git commit and vice versa?
39+
40+
While Nerdbank.GitVersioning calculates the version and applies it to most builds automatically,
41+
there can be occasions where you want to do so yourself or reverse the process to determine
42+
the commit that produced a given version.
43+
44+
To do this use [the `nbgv` tool](nbgv-cli.md) with the `get-version` or `get-commits` command.
45+
46+
Another (deprecated) option is to use a pair of Powershell scripts are included in the Nerdbank.GitVersioning NuGet package
47+
that can help you to translate between the two representations.
48+
49+
tools\Get-CommitId.ps1
50+
tools\Get-Version.ps1
51+
52+
`Get-CommitId.ps1` takes a version and print out the matching commit (or possible commits, in the exceptionally rare event of a collision).
53+
`Get-Version.ps1` prints out the version information for the git commit current at HEAD.
54+
55+
## How do I build Nerdbank.GitVersioning from source?
56+
57+
Prerequisites and build instructions are found in our
58+
[contributing guidelines](https://github.com/dotnet/Nerdbank.GitVersioning/tree/main/CONTRIBUTING.md).
59+
60+
## How do I consume the latest changes prior to their release on nuget.org?
61+
62+
We have [a public feed][PublicCI] where our CI pushes packages.
63+
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.
64+
65+
[PublicCI]: https://dev.azure.com/andrewarnott/OSS/_packaging?_a=feed&feed=PublicCI

docfx/docs/features.md

-3
This file was deleted.

0 commit comments

Comments
 (0)