Skip to content

Commit 553bd06

Browse files
authored
Merge pull request #704 from dotnet/fix703
Update schema to encourage 3-4 component assembly versions as well
2 parents dbceee3 + d486cf6 commit 553bd06

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

src/NerdBank.GitVersioning.Tests/VersionFileTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ public void IsVersionDefined_String_ConsiderAncestorFolders()
9292
[Theory]
9393
[InlineData("2.3", null, null, 0, null, @"{""version"":""2.3""}")]
9494
[InlineData("2.3", "2.2", VersionOptions.VersionPrecision.Minor, 0, null, @"{""version"":""2.3"",""assemblyVersion"":""2.2""}")]
95+
[InlineData("2.3", "1.2.3", VersionOptions.VersionPrecision.Minor, 0, null, @"{""version"":""2.3"",""assemblyVersion"":{""version"":""1.2.3""}}")]
96+
[InlineData("2.3", "1.2.3.4", VersionOptions.VersionPrecision.Minor, 0, null, @"{""version"":""2.3"",""assemblyVersion"":{""version"":""1.2.3.4""}}")]
9597
[InlineData("2.3", "2.2", VersionOptions.VersionPrecision.Minor, -1, new[] { "refs/heads/master" }, @"{""version"":""2.3"",""assemblyVersion"":""2.2"",""versionHeightOffset"":-1,""publicReleaseRefSpec"":[""refs/heads/master""]}")]
9698
[InlineData("2.3", "2.2", VersionOptions.VersionPrecision.Minor, -1, new[] { "refs/heads/master" }, @"{""version"":""2.3"",""assemblyVersion"":""2.2"",""buildNumberOffset"":-1,""publicReleaseRefSpec"":[""refs/heads/master""]}")]
9799
[InlineData("2.3", "2.2", VersionOptions.VersionPrecision.Minor, 0, null, @"{""version"":""2.3"",""assemblyVersion"":{""version"":""2.2""}}")]

src/NerdBank.GitVersioning/VersionOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ public AssemblyVersionOptions(AssemblyVersionOptions copyFrom)
741741
}
742742

743743
/// <summary>
744-
/// Gets or sets the major.minor components of the assembly version.
744+
/// Gets or sets the components of the assembly version (2-4 components).
745745
/// </summary>
746746
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
747747
public Version? Version

src/NerdBank.GitVersioning/version.schema.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@
3939
"default": false
4040
},
4141
"assemblyVersion": {
42-
"description": "The x.y version to use particularly for the AssemblyVersionAttribute instead of the default. This is useful when maintaining assembly binding compatibility on the desktop .NET Framework is important even though AssemblyFileVersion may change.",
42+
"description": "The a.b[.c[.d]] version to use particularly for the AssemblyVersionAttribute instead of the default. This is useful when maintaining assembly binding compatibility on the desktop .NET Framework is important even though AssemblyFileVersion may change.",
4343
"oneOf": [
44-
{ "$ref": "#/definitions/majorMinorVersion" },
44+
{ "$ref": "#/definitions/twoToFourComponentVersion" },
4545
{
4646
"type": "object",
4747
"properties": {
48-
"version": { "$ref": "#/definitions/majorMinorVersion" },
48+
"version": { "$ref": "#/definitions/twoToFourComponentVersion" },
4949
"precision": {
5050
"type": "string",
5151
"description": "Identifies the last component to be explicitly set in the version.",
@@ -193,10 +193,10 @@
193193
}
194194
}
195195
},
196-
"majorMinorVersion": {
196+
"twoToFourComponentVersion": {
197197
"type": "string",
198-
"description": "A major.minor version",
199-
"pattern": "^\\d+\\.\\d+$"
198+
"description": "A major.minor[.build[.revision]] version (2-4 version components).",
199+
"pattern": "^\\d+\\.\\d+(?:\\.\\d+(?:\\.\\d+)?)?$"
200200
}
201201
}
202202
}

0 commit comments

Comments
 (0)