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: docfx/docs/versionJson.md
+78-1Lines changed: 78 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -65,7 +65,8 @@ The content of the version.json file is a JSON serialized object with these prop
65
65
"versionIncrement":"minor",
66
66
"firstUnstableTag":"alpha"
67
67
},
68
-
"inherit":false// optional. Set to true in secondary version.json files used to tweak settings for subsets of projects.
68
+
"inherit":false, // optional. Set to true in secondary version.json files used to tweak settings for subsets of projects.
69
+
"prerelease":"beta"// optional. Only valid when inherit is true. Adds or overrides the prerelease tag of the inherited version.
69
70
}
70
71
```
71
72
@@ -109,4 +110,80 @@ In this example, the offset of 100 will be applied as long as the version remain
109
110
> [!NOTE]
110
111
> This feature is particularly useful when a `version.json` file uses `"inherit": true` to get the version from a parent `version.json` file higher in the source tree. In such cases, you can set `versionHeightOffset` and `versionHeightOffsetAppliesTo` in the inheriting file without having to update it when the parent version changes. The offset will automatically stop applying when the inherited version no longer matches `versionHeightOffsetAppliesTo`.
111
112
113
+
## Prerelease Tag in Inheriting Files
114
+
115
+
The `prerelease` property allows a version.json file that inherits from a parent to add or override the prerelease tag without duplicating the version number. This is particularly useful when you want to publish an "unstable" prerelease from a stable branch, or when one package is still considered unstable while its peers are already stable.
116
+
117
+
### Usage Rules
118
+
119
+
- The `prerelease` property can **only** be used when `"inherit": true` is set.
120
+
- The `version` property in the inheriting file must **not** include a prerelease tag (the `-suffix` part).
121
+
- Setting `"prerelease": "beta"` will append `-beta` to the inherited version.
122
+
- Setting `"prerelease": ""` (empty string) will explicitly **suppress** any prerelease tag inherited from the parent.
123
+
- Omitting the `prerelease` property will inherit the prerelease tag as-is from the parent.
124
+
125
+
### Examples
126
+
127
+
**Example 1: Adding a prerelease tag to a stable inherited version**
Copy file name to clipboardExpand all lines: src/NerdBank.GitVersioning/version.schema.json
+10Lines changed: 10 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,7 @@
16
16
"inheritingFile": {
17
17
"allOf": [
18
18
{ "$ref": "#/definitions/allProperties" },
19
+
{ "$ref": "#/definitions/inheritingProperties" },
19
20
{ "required": [ "inherit" ] },
20
21
{
21
22
"properties": {
@@ -217,6 +218,15 @@
217
218
}
218
219
}
219
220
},
221
+
"inheritingProperties": {
222
+
"properties": {
223
+
"prerelease": {
224
+
"type": "string",
225
+
"description": "A prerelease tag to append to the version inherited from a parent version.json file. This property can only be used when 'inherit' is true and the 'version' property does not include a prerelease tag. Set to an empty string to explicitly suppress an inherited prerelease tag. Omit this property to inherit the prerelease tag as-is from the parent.",
226
+
"pattern": "^[\\da-zA-Z\\-]*$"
227
+
}
228
+
}
229
+
},
220
230
"twoToFourComponentVersion": {
221
231
"type": "string",
222
232
"description": "A major.minor[.build[.revision]] version (2-4 version components).",
0 commit comments