@@ -22,7 +22,7 @@ You can now use standard .NET numeric format strings with version components:
2222
2323``` yaml
2424# GitVersion.yml
25- template : " {Major}.{Minor}.{Patch:F2}-{PreReleaseLabel}"
25+ assembly-informational-format : " {Major}.{Minor}.{Patch:F2}-{PreReleaseLabel}"
2626` ` `
2727
2828**Supported Numeric Formats:**
@@ -39,7 +39,7 @@ template: "{Major}.{Minor}.{Patch:F2}-{PreReleaseLabel}"
3939When working with date-related properties like `CommitDate` :
4040
4141` ` ` yaml
42- template : "Build-{SemVer}-{CommitDate:yyyy-MM-dd}"
42+ assembly-informational-format : "Build-{SemVer}-{CommitDate:yyyy-MM-dd}"
4343` ` `
4444
4545**Common Date Format Specifiers:**
@@ -71,15 +71,15 @@ branches:
7171 feature:
7272 label: "{BranchName:c}" # Converts to PascalCase
7373
74- template : "{Major}.{Minor}.{Patch}-{PreReleaseLabel:l}.{CommitsSinceVersionSource:0000}"
74+ assembly-informational-format : "{Major}.{Minor}.{Patch}-{PreReleaseLabel:l}.{CommitsSinceVersionSource:0000}"
7575` ` `
7676
7777**Template Usage:**
7878
7979` ` ` yaml
8080# Using format strings in templates
8181assembly-informational-format: "{Major}.{Minor}.{Patch}-{CommitsSinceVersionSource:0000}"
82- template : "{SemVer}-{BranchName:l}"
82+ assembly-informational-format : "{SemVer}-{BranchName:l}"
8383` ` `
8484
8585# # Examples
@@ -107,21 +107,21 @@ branches:
107107# ## Date and Time Formatting
108108
109109` ` ` yaml
110- template : "{SemVer}-build-{CommitDate:yyyy-MM-dd}"
110+ assembly-informational-format : "{SemVer}-build-{CommitDate:yyyy-MM-dd}"
111111# Result: "1.2.3-build-2021-01-01"
112112` ` `
113113
114114# ## Numeric Formatting
115115
116116` ` ` yaml
117117# Currency format (uses InvariantCulture)
118- template : "Cost-{Major:C}" # Result: "Cost-¤1.00"
118+ assembly-informational-format : "Cost-{Major:C}" # Result: "Cost-¤1.00"
119119
120120# Percentage format
121- template : "Progress-{Minor:P}" # Result: "Progress-200.00 %"
121+ assembly-informational-format : "Progress-{Minor:P}" # Result: "Progress-200.00 %"
122122
123123# Thousands separator
124- template : "Build-{CommitsSinceVersionSource:N0}" # Result: "Build-1,234"
124+ assembly-informational-format : "Build-{CommitsSinceVersionSource:N0}" # Result: "Build-1,234"
125125` ` `
126126
127127# # Configuration Integration
@@ -137,28 +137,11 @@ assembly-versioning-format: "{Major}.{Minor}.{Patch}.{env:BUILD_NUMBER}"
137137assembly-file-versioning-format: "{MajorMinorPatch}.{CommitsSinceVersionSource}"
138138` ` `
139139
140- # ## Template-Based Configuration
141-
142- ` ` ` yaml
143- # Global template for consistent formatting across all variables
144- template: "{SemVer}-{BranchName:l}-{ShortSha}"
145-
146- branches:
147- main:
148- label: ""
149- feature:
150- label: "{BranchName:c}.{CommitsSinceVersionSource}"
151- increment: Minor
152- release:
153- label: "rc-{CommitsSinceVersionSource:000}"
154- increment: None
155- ` ` `
156-
157140# ## Environment Variable Integration
158141
159142` ` ` yaml
160143# Using environment variables with fallbacks
161- template : "{Major}.{Minor}.{Patch}-{env:RELEASE_STAGE ?? 'dev'}"
144+ assembly-informational-format : "{Major}.{Minor}.{Patch}-{env:RELEASE_STAGE ?? 'dev'}"
162145assembly-informational-format: "{SemVer}+{env:BUILD_ID ?? 'local'}"
163146` ` `
164147
@@ -196,57 +179,3 @@ The formatting system uses `CultureInfo.InvariantCulture` by default through the
196179` ` `
197180
198181This ensures that version strings generated by GitVersion are consistent across different build environments, developer machines, and CI/CD systems.
199-
200- # # Verified Examples
201-
202- The following examples are verified by actual unit tests in the GitVersion codebase :
203-
204- # ## Zero-Padded Numeric Formatting
205-
206- ` ` ` yaml
207- assembly-informational-format: "{Major}.{Minor}.{Patch}-{CommitsSinceVersionSource:0000}"
208- ` ` `
209-
210- **Test**: `VariableProviderTests.Format_Allows_CSharp_FormatStrings()`
211- **Input**: `CommitsSinceVersionSource = 42`
212- **Output**: `"1.2.3-0042"`
213-
214- # ## String Case Transformations
215-
216- ` ` ` csharp
217- // From StringFormatterTests.cs
218- [TestCase("hello world", "c", "HelloWorld")] // PascalCase
219- [TestCase("hello", "u", "HELLO")] // Uppercase
220- [TestCase("HELLO", "l", "hello")] // Lowercase
221- [TestCase("hello world", "t", "Hello World")] // Title Case
222- [TestCase("hELLO", "s", "Hello")] // Sentence Case
223- ` ` `
224-
225- # ## Numeric Format Specifiers
226-
227- ` ` ` csharp
228- // From NumericFormatterTests.cs
229- [TestCase("1234.5678", "n", "1,234.57")] // Number format
230- [TestCase("1234.5678", "f2", "1234.57")] // Fixed-point format
231- [TestCase("1234.5678", "f0", "1235")] // No decimals
232- ` ` `
233-
234- # ## Date Formatting
235-
236- ` ` ` csharp
237- // From DateFormatterTests.cs
238- [TestCase("2021-01-01", "yyyy-MM-dd", "2021-01-01")]
239- [TestCase("2021-01-01T12:00:00Z", "yyyy-MM-ddTHH:mm:ssZ", "2021-01-01T12:00:00Z")]
240- ` ` `
241-
242- # ## Currency and Percentage (InvariantCulture)
243-
244- ` ` ` csharp
245- // From FormattableFormatterTests.cs
246- [TestCase(123.456, "C", "¤123.46")] // Generic currency symbol
247- [TestCase(123.456, "P", "12,345.60 %")] // Percentage format
248- [TestCase(1234567890, "N0", "1,234,567,890")] // Thousands separators
249- ` ` `
250-
251- [reference-configuration] : /docs/reference/configuration
252- [variables] : /docs/reference/variables
0 commit comments