Skip to content

Commit 1d9e30c

Browse files
authored
Merge pull request #921 from onovotny/exclude-assemblyversion
Allow `assembly-versioning-scheme` to be set to `None` to skip updating the `AssemblyVersion` while still updating the `AssemblyFileVersion` and `AssemblyInformationVersion` attributes.
2 parents 9643410 + 2ffc19e commit 1d9e30c

13 files changed

+90
-6
lines changed

docs/configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ The global configuration options are:
1818

1919
- **`next-version:`** Allows you to bump the next version explicitly, useful for bumping `master` or a feature with breaking changes a major increment.
2020

21-
- **`assembly-versioning-scheme:`** When updating assembly info tells GitVersion how to treat the `AssemblyVersion` attribute. Useful to lock the major when using Strong Naming.
21+
- **`assembly-versioning-scheme:`** When updating assembly info tells GitVersion how to treat the `AssemblyVersion` attribute. Useful to lock the major when using Strong Naming. Note: you can use `None` to skip updating the `AssemblyVersion` while still updating the `AssemblyFileVersion` and `AssemblyInformationVersion` attributes.
2222

2323
- **`assembly-informational-format:`** Set this to any of the available [variables](/more-info/variables) to change the value of the `AssemblyInformationalVersion` attribute. Default set to `{InformationalVersion}`. It also supports string interpolation (`{MajorMinorPatch}+{Branch}`)
2424

src/GitVersionCore/AssemblyVersioningScheme.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ public enum AssemblyVersioningScheme
55
MajorMinorPatchTag,
66
MajorMinorPatch,
77
MajorMinor,
8-
Major
8+
Major,
9+
None
910
}
1011
}

src/GitVersionCore/AssemblyVersionsGenerator.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ public static string GetAssemblyVersion(
1818
return string.Format("{0}.{1}.{2}.0", sv.Major, sv.Minor, sv.Patch);
1919
case AssemblyVersioningScheme.MajorMinorPatchTag:
2020
return string.Format("{0}.{1}.{2}.{3}", sv.Major, sv.Minor, sv.Patch, sv.PreReleaseTag.Number ?? 0);
21+
case AssemblyVersioningScheme.None:
22+
return null;
2123
default:
2224
throw new ArgumentException(string.Format("Unexpected value ({0}).", scheme), "scheme");
2325
}

src/GitVersionCore/Configuration/Init/SetConfig/AssemblyVersioningSchemeSetting.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ protected override StepResult HandleResult(string result, Queue<ConfigInitWizard
3333
config.AssemblyVersioningScheme = AssemblyVersioningScheme.MajorMinorPatchTag;
3434
steps.Enqueue(new EditConfigStep(Console, FileSystem));
3535
return StepResult.Ok();
36+
case "5":
37+
config.AssemblyVersioningScheme = AssemblyVersioningScheme.None;
38+
steps.Enqueue(new EditConfigStep(Console, FileSystem));
39+
return StepResult.Ok();
3640
}
3741

3842
return StepResult.InvalidResponseSelected();
@@ -46,7 +50,9 @@ protected override string GetPrompt(Config config, string workingDirectory)
4650
1) Major.0.0.0
4751
2) Major.Minor.0.0
4852
3) Major.Minor.Patch.0 (default)
49-
4) Major.Minor.Patch.TagCount (Allows different pre-release tags to cause assembly version to change)";
53+
4) Major.Minor.Patch.TagCount (Allows different pre-release tags to cause assembly version to change)
54+
5) None (skip's updating AssemblyVersion)";
55+
5056
}
5157

5258
protected override string DefaultResult
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[assembly: AssemblyFileVersion("2.3.1.0")]
2+
[assembly: AssemblyInformationalVersion("2.3.1+3.Branch.foo.Sha.hash")]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[assembly: AssemblyFileVersion("2.3.1.0")]
2+
[assembly: AssemblyInformationalVersion("2.3.1+3.Branch.foo.Sha.hash")]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[<assembly: AssemblyFileVersion("2.3.1.0")>]
2+
[<assembly: AssemblyInformationalVersion("2.3.1+3.Branch.foo.Sha.hash")>]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[<assembly: AssemblyFileVersion("2.3.1.0")>]
2+
[<assembly: AssemblyInformationalVersion("2.3.1+3.Branch.foo.Sha.hash")>]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<Assembly: AssemblyFileVersion("2.3.1.0")>
2+
<assembly: AssemblyInformationalVersion("2.3.1+3.Branch.foo.Sha.hash")>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<Assembly: AssemblyFileVersion("2.3.1.0")>
2+
<assembly: AssemblyInformationalVersion("2.3.1+3.Branch.foo.Sha.hash")>

0 commit comments

Comments
 (0)