Skip to content

Commit 6245782

Browse files
committed
Documentation
1 parent 3629aef commit 6245782

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

docs/input/docs/reference/custom-formatting.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,30 @@ assembly-informational-format: "{Major}.{Minor}.{Patch}-{CommitsSinceVersionSour
8282
assembly-informational-format: "{SemVer}-{BranchName:l}"
8383
```
8484

85+
## Legacy .NET Composite Format Syntax
86+
87+
GitVersion maintains backward compatibility with legacy .NET composite format syntax using semicolons for positive/negative/zero sections:
88+
89+
```yaml
90+
# Legacy zero-padded with empty fallback
91+
assembly-informational-format: "{Major}.{Minor}.{Patch}-{CommitsSinceVersionSource:0000;;''}"
92+
# Result: "6.13.54-0002" (or "6.13.54" when CommitsSinceVersionSource is 0)
93+
94+
# Three-section format: positive;negative;zero
95+
assembly-informational-format: "{Value:positive;negative;zero}"
96+
97+
# Two-section format: positive;negative
98+
assembly-informational-format: "{Value:pos;neg}"
99+
```
100+
101+
**Format Sections:**
102+
- **First section**: Used for positive values
103+
- **Second section**: Used for negative values
104+
- **Third section**: Used for zero values (optional)
105+
- **Empty quotes** (`''` or `""`) create empty output
106+
107+
**Mixed Syntax:** You can combine legacy semicolon syntax with modern `??` fallback syntax in the same template.
108+
85109
## Examples
86110

87111
Based on actual test cases from the implementation:

0 commit comments

Comments
 (0)