diff --git a/build.cake b/build.cake
index a9da3088f9..00b9f4f998 100644
--- a/build.cake
+++ b/build.cake
@@ -124,7 +124,7 @@ Task("Create-Release-Notes")
.WithCriteria(() => IsMainGitVersionRepo && IsMainGitVersionBranch && !IsPullRequest)
.Does(() =>
{
- var githubToken = EnvironmentVariable("GitHubToken");
+ var githubToken = EnvironmentVariable("GitHubToken");
if(!string.IsNullOrWhiteSpace(githubToken))
{
diff --git a/docs/configuration.md b/docs/configuration.md
index 967de0e138..c4b89cd31f 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -30,6 +30,7 @@ The global configuration look like this:
```yaml
next-version: 1.0
assembly-versioning-scheme: MajorMinorPatch
+assembly-file-versioning-scheme: MajorMinorPatchTag
assembly-informational-format: '{InformationalVersion}'
mode: ContinuousDelivery
increment: Inherit
@@ -61,6 +62,12 @@ Strong Naming. Note: you can use `None` to skip updating the `AssemblyVersion`
while still updating the `AssemblyFileVersion` and `AssemblyInformationVersion`
attributes.
+### assembly-file-versioning-scheme
+When updating assembly info, `assembly-file-versioning-scheme` tells GitVersion how
+to treat the `AssemblyFileVersion` attribute. Note: you can use `None` to skip updating the `AssemblyFileVersion`
+while still updating the `AssemblyVersion` and `AssemblyInformationVersion`
+attributes.
+
### 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
diff --git a/docs/git-branching-strategies/gitflow-examples.md b/docs/git-branching-strategies/gitflow-examples.md
index b298c0bfa8..a8884b5e87 100644
--- a/docs/git-branching-strategies/gitflow-examples.md
+++ b/docs/git-branching-strategies/gitflow-examples.md
@@ -10,7 +10,7 @@ Feature branches will take the feature branch name and use that as the pre-relea
Notice after the feature branch is merged, the version on `develop` is `1.3.0-alpha.3`. This is due to `develop` running in *continuous deployment* mode. If you configured `develop` to use *continuous delivery* the version would still be `1.3.0-alpha.1` and you would have to use release tags to increment the `alpha.1`.
-You can see the different on the feature branch itself, notice the version is the same before and after the commit on the feature branch? Only the metadata has changed. If you released the feature branch artifacts then tagged the commit, the following commit would increase to `-beta.2`.
+You can see the difference on the feature branch itself, notice the version is the same before and after the commit on the feature branch? Only the metadata has changed. If you released the feature branch artifacts then tagged the commit, the following commit would increase to `-beta.2`.
## Pull Request
Because feature branches are most likely pushed to a fork, we are showing the
diff --git a/docs/more-info/variables.md b/docs/more-info/variables.md
index 9ad11cede9..8c955605ed 100644
--- a/docs/more-info/variables.md
+++ b/docs/more-info/variables.md
@@ -19,6 +19,7 @@ For the `release/3.0.0` branch of GitVersion it shows:
"LegacySemVer":"3.0.0-beta1",
"LegacySemVerPadded":"3.0.0-beta0001",
"AssemblySemVer":"3.0.0.0",
+ "AssemblySemFileVer":"3.0.0.0",
"FullSemVer":"3.0.0-beta.1+1",
"InformationalVersion":"3.0.0-beta.1+1.Branch.release/3.0.0.Sha.28c853159a46b5a87e6cc9c4f6e940c59d6bc68a",
"BranchName":"release/3.0.0",
diff --git a/docs/usage/msbuild-task.md b/docs/usage/msbuild-task.md
index 4b99a536f8..d5d5d15995 100644
--- a/docs/usage/msbuild-task.md
+++ b/docs/usage/msbuild-task.md
@@ -4,6 +4,8 @@ The MSBuild Task for GitVersion — **GitVersionTask** — is a simple solution
you want to version your assemblies without writing any command line scripts or
modifying your build process.
+It currently works with desktop `MSBuild`. Support for CoreCLR with `dotnet build` is coming soon.
+
## TL;DR
### Install the MSTask targets
@@ -16,6 +18,14 @@ From the Package Manager Console:
Install-Package GitVersionTask
```
+If you're using `PackageReference` style NuGet dependencies (VS 2017+), add `all` to prevent the task from becoming a dependency of your package:
+
+``` xml
+
+ All
+
+```
+
### Remove AssemblyInfo attributes
The next thing you need to do is to remove the `Assembly*Version` attributes from
@@ -115,6 +125,17 @@ However at MSBuild time these properties are mapped to MSBuild properties that
are prefixed with `GitVersion_`. This prevents conflicts with other properties
in the pipeline.
+In addition, the following MSBuild properties are set when `UpdateVersionProperties` is true (the default):
+`Version`, `VersionPrefix`, `VersionSuffix`, `PackageVersion`, `InformationalVersion`, `AssemblyVersion` and `FileVersion`. These are used by the built-in tasks for generating AssemblyInfo's and NuGet package versions.
+
+
+### NuGet packages
+The new SDK-style projects available for .NET Standard libraries (and multi-targeting), have the ability
+to create NuGet packages directly by using the `pack` target: `msbuild /t:pack`. The version is controled by the MSBuild properties described above.
+
+GitVersionTask has the option to generate SemVer 2.0 compliant NuGet package versions by setting `UseFullSemVerForNuGet` to true in your project (this is off by default for compatibility). Some hosts, like MyGet, support SemVer 2.0 package versions but older NuGet clients and nuget.org do not.
+
+
#### Accessing variables in MSBuild
Once `GitVersionTask.GetVersion` has been executed, the MSBuild properties can be
@@ -136,7 +157,7 @@ Build Server log in a format that the current Build Server can consume. See
## Conditional control tasks
-Properties `WriteVersionInfoToBuildLog`, `UpdateAssemblyInfo` and `GetVersion`
+Properties `WriteVersionInfoToBuildLog`, `UpdateAssemblyInfo`, `UseFullSemVerForNuGet`, `UpdateVersionProperties` and `GetVersion`
are checked before running these tasks.
You can disable `GitVersionTask.UpdateAssemblyInfo` by setting
@@ -150,6 +171,7 @@ this:
...
```
+For SDK-style projects, `UpdateVersionProperties` controls setting the default variables: `Version`, `VersionPrefix`, `VersionSuffix`, `PackageVersion`, `InformationalVersion`, `AssemblyVersion` and `FileVersion`.
## My Git repository requires authentication. What should I do?
diff --git a/src/GitVersionCore.Tests/Approved/JsonVersionBuilderTests.Json.approved.txt b/src/GitVersionCore.Tests/Approved/JsonVersionBuilderTests.Json.approved.txt
index 93fa4d2539..76f74d5073 100644
--- a/src/GitVersionCore.Tests/Approved/JsonVersionBuilderTests.Json.approved.txt
+++ b/src/GitVersionCore.Tests/Approved/JsonVersionBuilderTests.Json.approved.txt
@@ -1,4 +1,4 @@
-{
+{
"Major":1,
"Minor":2,
"Patch":0,
@@ -14,6 +14,7 @@
"LegacySemVer":"1.2.0-unstable4",
"LegacySemVerPadded":"1.2.0-unstable0004",
"AssemblySemVer":"1.2.0.0",
+ "AssemblySemFileVer":"1.2.0.0",
"FullSemVer":"1.2.0-unstable.4+5",
"InformationalVersion":"1.2.0-unstable.4+5.Branch.feature1.Sha.commitSha",
"BranchName":"feature1",
diff --git a/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeliveryModeForPreRelease.approved.txt b/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeliveryModeForPreRelease.approved.txt
index 24b9530cec..b35176f231 100644
--- a/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeliveryModeForPreRelease.approved.txt
+++ b/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeliveryModeForPreRelease.approved.txt
@@ -1,4 +1,4 @@
-{
+{
"Major":1,
"Minor":2,
"Patch":3,
@@ -14,6 +14,7 @@
"LegacySemVer":"1.2.3-unstable4",
"LegacySemVerPadded":"1.2.3-unstable0004",
"AssemblySemVer":"1.2.3.0",
+ "AssemblySemFileVer":"1.2.3.0",
"FullSemVer":"1.2.3-unstable.4+5",
"InformationalVersion":"1.2.3-unstable.4+5.Branch.develop.Sha.commitSha",
"BranchName":"develop",
diff --git a/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeliveryModeForPreReleaseWithPadding.approved.txt b/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeliveryModeForPreReleaseWithPadding.approved.txt
index c0a6a2d26b..ada2ae55c4 100644
--- a/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeliveryModeForPreReleaseWithPadding.approved.txt
+++ b/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeliveryModeForPreReleaseWithPadding.approved.txt
@@ -1,4 +1,4 @@
-{
+{
"Major":1,
"Minor":2,
"Patch":3,
@@ -14,6 +14,7 @@
"LegacySemVer":"1.2.3-unstable4",
"LegacySemVerPadded":"1.2.3-unstable00004",
"AssemblySemVer":"1.2.3.0",
+ "AssemblySemFileVer":"1.2.3.0",
"FullSemVer":"1.2.3-unstable.4+5",
"InformationalVersion":"1.2.3-unstable.4+5.Branch.develop.Sha.commitSha",
"BranchName":"develop",
diff --git a/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeliveryModeForStable.approved.txt b/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeliveryModeForStable.approved.txt
index 1f354270ad..7fc32ced80 100644
--- a/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeliveryModeForStable.approved.txt
+++ b/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeliveryModeForStable.approved.txt
@@ -1,4 +1,4 @@
-{
+{
"Major":1,
"Minor":2,
"Patch":3,
@@ -14,6 +14,7 @@
"LegacySemVer":"1.2.3",
"LegacySemVerPadded":"1.2.3",
"AssemblySemVer":"1.2.3.0",
+ "AssemblySemFileVer":"1.2.3.0",
"FullSemVer":"1.2.3+5",
"InformationalVersion":"1.2.3+5.Branch.develop.Sha.commitSha",
"BranchName":"develop",
diff --git a/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeploymentModeForPreRelease.approved.txt b/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeploymentModeForPreRelease.approved.txt
index 3726dd9ece..db6df7caf5 100644
--- a/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeploymentModeForPreRelease.approved.txt
+++ b/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeploymentModeForPreRelease.approved.txt
@@ -1,4 +1,4 @@
-{
+{
"Major":1,
"Minor":2,
"Patch":3,
@@ -14,6 +14,7 @@
"LegacySemVer":"1.2.3-unstable5",
"LegacySemVerPadded":"1.2.3-unstable0005",
"AssemblySemVer":"1.2.3.0",
+ "AssemblySemFileVer":"1.2.3.0",
"FullSemVer":"1.2.3-unstable.5",
"InformationalVersion":"1.2.3-unstable.5+Branch.develop.Sha.commitSha",
"BranchName":"develop",
diff --git a/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeploymentModeForStable.approved.txt b/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeploymentModeForStable.approved.txt
index cc5b1bd162..e6513c5894 100644
--- a/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeploymentModeForStable.approved.txt
+++ b/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeploymentModeForStable.approved.txt
@@ -1,4 +1,4 @@
-{
+{
"Major":1,
"Minor":2,
"Patch":3,
@@ -14,6 +14,7 @@
"LegacySemVer":"1.2.3-ci5",
"LegacySemVerPadded":"1.2.3-ci0005",
"AssemblySemVer":"1.2.3.0",
+ "AssemblySemFileVer":"1.2.3.0",
"FullSemVer":"1.2.3-ci.5",
"InformationalVersion":"1.2.3-ci.5+Branch.develop.Sha.commitSha",
"BranchName":"develop",
diff --git a/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeploymentModeForStableWhenCurrentCommitIsTagged.approved.txt b/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeploymentModeForStableWhenCurrentCommitIsTagged.approved.txt
index 59ad7577f5..eaa4c8f8bf 100644
--- a/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeploymentModeForStableWhenCurrentCommitIsTagged.approved.txt
+++ b/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeploymentModeForStableWhenCurrentCommitIsTagged.approved.txt
@@ -1,4 +1,4 @@
-{
+{
"Major":1,
"Minor":2,
"Patch":3,
@@ -14,6 +14,7 @@
"LegacySemVer":"1.2.3",
"LegacySemVerPadded":"1.2.3",
"AssemblySemVer":"1.2.3.0",
+ "AssemblySemFileVer":"1.2.3.0",
"FullSemVer":"1.2.3+5",
"InformationalVersion":"1.2.3+5.Sha.commitSha",
"BranchName":"",
diff --git a/src/GitVersionCore.Tests/AssemblyFileVersionTests.cs b/src/GitVersionCore.Tests/AssemblyFileVersionTests.cs
new file mode 100644
index 0000000000..e09f186191
--- /dev/null
+++ b/src/GitVersionCore.Tests/AssemblyFileVersionTests.cs
@@ -0,0 +1,29 @@
+using GitVersion;
+using NUnit.Framework;
+
+namespace GitVersionCore.Tests
+{
+ using Shouldly;
+
+ [TestFixture]
+ public class AssemblyFileVersionTests
+ {
+ [TestCase(AssemblyFileVersioningScheme.None, 1, 2, 3, 4, null)]
+ [TestCase(AssemblyFileVersioningScheme.Major, 1, 2, 3, 4, "1.0.0.0")]
+ [TestCase(AssemblyFileVersioningScheme.MajorMinor, 1, 2, 3, 4, "1.2.0.0")]
+ [TestCase(AssemblyFileVersioningScheme.MajorMinorPatch, 1, 2, 3, 4, "1.2.3.0")]
+ [TestCase(AssemblyFileVersioningScheme.MajorMinorPatchTag, 1, 2, 3, 4, "1.2.3.4")]
+ public void ValidateAssemblyFileVersionBuilder(AssemblyFileVersioningScheme assemblyFileVersioningScheme, int major, int minor, int patch,
+ int tag, string versionString)
+ {
+ var semVer = new SemanticVersion(major, minor, patch)
+ {
+ PreReleaseTag = new SemanticVersionPreReleaseTag("Test", tag)
+ };
+
+ var assemblyFileVersion = semVer.GetAssemblyFileVersion(assemblyFileVersioningScheme);
+
+ assemblyFileVersion.ShouldBe(versionString);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/GitVersionCore.Tests/ConfigProviderTests.CanWriteOutEffectiveConfiguration.approved.txt b/src/GitVersionCore.Tests/ConfigProviderTests.CanWriteOutEffectiveConfiguration.approved.txt
index 8b960906c5..c125562762 100644
--- a/src/GitVersionCore.Tests/ConfigProviderTests.CanWriteOutEffectiveConfiguration.approved.txt
+++ b/src/GitVersionCore.Tests/ConfigProviderTests.CanWriteOutEffectiveConfiguration.approved.txt
@@ -1,4 +1,5 @@
assembly-versioning-scheme: MajorMinorPatch
+assembly-file-versioning-scheme: MajorMinorPatch
mode: ContinuousDelivery
tag-prefix: '[vV]'
continuous-delivery-fallback-tag: ci
diff --git a/src/GitVersionCore.Tests/ConfigProviderTests.cs b/src/GitVersionCore.Tests/ConfigProviderTests.cs
index a1d7c1833f..97ee33c2b9 100644
--- a/src/GitVersionCore.Tests/ConfigProviderTests.cs
+++ b/src/GitVersionCore.Tests/ConfigProviderTests.cs
@@ -165,12 +165,14 @@ public void CanUpdateAssemblyInformationalVersioningScheme()
{
const string text = @"
assembly-versioning-scheme: MajorMinor
+assembly-file-versioning-scheme: MajorMinorPatch
assembly-informational-format: '{NugetVersion}'";
SetupConfigFileContent(text);
var config = ConfigurationProvider.Provide(repoPath, fileSystem);
config.AssemblyVersioningScheme.ShouldBe(AssemblyVersioningScheme.MajorMinor);
+ config.AssemblyFileVersioningScheme.ShouldBe(AssemblyFileVersioningScheme.MajorMinorPatch);
config.AssemblyInformationalFormat.ShouldBe("{NugetVersion}");
}
@@ -179,12 +181,14 @@ public void CanUpdateAssemblyInformationalVersioningSchemeWithMultipleVariables(
{
const string text = @"
assembly-versioning-scheme: MajorMinor
+assembly-file-versioning-scheme: MajorMinorPatch
assembly-informational-format: '{Major}.{Minor}.{Patch}'";
SetupConfigFileContent(text);
var config = ConfigurationProvider.Provide(repoPath, fileSystem);
config.AssemblyVersioningScheme.ShouldBe(AssemblyVersioningScheme.MajorMinor);
+ config.AssemblyFileVersioningScheme.ShouldBe(AssemblyFileVersioningScheme.MajorMinorPatch);
config.AssemblyInformationalFormat.ShouldBe("{Major}.{Minor}.{Patch}");
}
@@ -193,6 +197,7 @@ public void CanUpdateAssemblyInformationalVersioningSchemeWithMultipleVariables(
public void CanUpdateAssemblyInformationalVersioningSchemeWithFullSemVer()
{
const string text = @"assembly-versioning-scheme: MajorMinorPatch
+assembly-file-versioning-scheme: MajorMinorPatch
assembly-informational-format: '{FullSemVer}'
mode: ContinuousDelivery
next-version: 5.3.0
@@ -202,6 +207,7 @@ public void CanUpdateAssemblyInformationalVersioningSchemeWithFullSemVer()
var config = ConfigurationProvider.Provide(repoPath, fileSystem);
config.AssemblyVersioningScheme.ShouldBe(AssemblyVersioningScheme.MajorMinorPatch);
+ config.AssemblyFileVersioningScheme.ShouldBe(AssemblyFileVersioningScheme.MajorMinorPatch);
config.AssemblyInformationalFormat.ShouldBe("{FullSemVer}");
}
@@ -212,6 +218,7 @@ public void CanReadDefaultDocument()
SetupConfigFileContent(text);
var config = ConfigurationProvider.Provide(repoPath, fileSystem);
config.AssemblyVersioningScheme.ShouldBe(AssemblyVersioningScheme.MajorMinorPatch);
+ config.AssemblyFileVersioningScheme.ShouldBe(AssemblyFileVersioningScheme.MajorMinorPatch);
config.AssemblyInformationalFormat.ShouldBe(null);
config.Branches["develop"].Tag.ShouldBe("alpha");
config.Branches["release"].Tag.ShouldBe("beta");
diff --git a/src/GitVersionCore.Tests/DynamicRepositoryTests.cs b/src/GitVersionCore.Tests/DynamicRepositoryTests.cs
new file mode 100644
index 0000000000..968f691ae0
--- /dev/null
+++ b/src/GitVersionCore.Tests/DynamicRepositoryTests.cs
@@ -0,0 +1,50 @@
+using System.IO;
+using GitVersion;
+using NUnit.Framework;
+
+[TestFixture]
+public class DynamicRepositoryTests
+{
+ string workDirectory;
+
+
+ [SetUp]
+ public void CreateTemporaryRepository()
+ {
+ // Note: we can't use guid because paths will be too long
+ workDirectory = Path.Combine(Path.GetTempPath(), "DynRepoTests");
+ }
+
+
+ //[TearDown]
+ //public void Cleanup()
+ //{
+ // Directory.Delete(workDirectory, true);
+ //}
+
+ [Ignore("These tests are slow and fail on the second run in Test Explorer and need to be re-written")]
+ [TestCase("GV_master_1", "https://github.com/GitTools/GitVersion", "master", "4783d325521463cd6cf1b61074352da84451f25d", "4.0.0+1126")]
+ [TestCase("GV_master_2", "https://github.com/GitTools/GitVersion", "master", "3bdcd899530b4e9b37d13639f317da04a749e728", "4.0.0+1132")]
+ public void FindsVersionInDynamicRepo(string name, string url, string targetBranch, string commitId, string expectedFullSemVer)
+ {
+ var root = Path.Combine(workDirectory, name);
+ var dynamicDirectory = Path.Combine(root, "dynamic");
+ var workingDirectory = Path.Combine(root, "working");
+
+ // Clear upfront
+ if (Directory.Exists(root))
+ {
+ Directory.Delete(root, true);
+ }
+
+ Directory.CreateDirectory(dynamicDirectory);
+ Directory.CreateDirectory(workingDirectory);
+
+ var executeCore = new ExecuteCore(new TestFileSystem());
+
+ var versionVariables = executeCore.ExecuteGitVersion(url, dynamicDirectory, null, targetBranch,
+ false, workingDirectory, commitId);
+
+ Assert.AreEqual(expectedFullSemVer, versionVariables.FullSemVer);
+ }
+}
\ No newline at end of file
diff --git a/src/GitVersionCore.Tests/ExecuteCoreTests.cs b/src/GitVersionCore.Tests/ExecuteCoreTests.cs
index 40cce24641..d167b60a52 100644
--- a/src/GitVersionCore.Tests/ExecuteCoreTests.cs
+++ b/src/GitVersionCore.Tests/ExecuteCoreTests.cs
@@ -56,6 +56,7 @@ public void CacheFileExistsOnDisk()
LegacySemVer: 4.10.3-test19
LegacySemVerPadded: 4.10.3-test0019
AssemblySemVer: 4.10.3.0
+AssemblySemFileVer: 4.10.3.0
FullSemVer: 4.10.3-test.19
InformationalVersion: 4.10.3-test.19+Branch.feature/test.Sha.dd2a29aff0c948e1bdf3dabbe13e1576e70d5f9f
BranchName: feature/test
@@ -101,6 +102,7 @@ public void CacheFileExistsOnDiskWhenOverrideConfigIsSpecifiedVersionShouldBeDyn
LegacySemVer: 4.10.3-test19
LegacySemVerPadded: 4.10.3-test0019
AssemblySemVer: 4.10.3.0
+AssemblySemFileVer: 4.10.3.0
FullSemVer: 4.10.3-test.19
InformationalVersion: 4.10.3-test.19+Branch.feature/test.Sha.dd2a29aff0c948e1bdf3dabbe13e1576e70d5f9f
BranchName: feature/test
@@ -163,6 +165,7 @@ public void ConfigChangeInvalidatesCache()
LegacySemVer: 4.10.3-test19
LegacySemVerPadded: 4.10.3-test0019
AssemblySemVer: 4.10.3.0
+AssemblySemFileVer: 4.10.3.0
FullSemVer: 4.10.3-test.19
InformationalVersion: 4.10.3-test.19+Branch.feature/test.Sha.dd2a29aff0c948e1bdf3dabbe13e1576e70d5f9f
BranchName: feature/test
@@ -211,6 +214,7 @@ public void NoCacheBypassesCache()
LegacySemVer: 4.10.3-test19
LegacySemVerPadded: 4.10.3-test0019
AssemblySemVer: 4.10.3.0
+AssemblySemFileVer: 4.10.3.0
FullSemVer: 4.10.3-test.19
InformationalVersion: 4.10.3-test.19+Branch.feature/test.Sha.dd2a29aff0c948e1bdf3dabbe13e1576e70d5f9f
BranchName: feature/test
diff --git a/src/GitVersionCore.Tests/GitVersionCore.Tests.csproj b/src/GitVersionCore.Tests/GitVersionCore.Tests.csproj
index d189ecbb41..f4ddf98a35 100644
--- a/src/GitVersionCore.Tests/GitVersionCore.Tests.csproj
+++ b/src/GitVersionCore.Tests/GitVersionCore.Tests.csproj
@@ -11,7 +11,7 @@
GitVersionCore.Tests
GitVersionCore.Tests
v4.5
- 5
+ 6
512
@@ -54,40 +54,12 @@
..\packages\LibGit2Sharp.0.23.0-pre20160922233542\lib\net40\LibGit2Sharp.dll
True
-
- ..\packages\NUnit3TestAdapter.3.4.1\lib\Mono.Cecil.dll
- True
-
-
- ..\packages\NUnit3TestAdapter.3.4.1\lib\Mono.Cecil.Mdb.dll
- True
-
-
- ..\packages\NUnit3TestAdapter.3.4.1\lib\Mono.Cecil.Pdb.dll
- True
-
-
- ..\packages\NUnit3TestAdapter.3.4.1\lib\Mono.Cecil.Rocks.dll
- True
-
..\packages\NSubstitute.1.10.0.0\lib\net45\NSubstitute.dll
True
-
- ..\packages\NUnit3TestAdapter.3.4.1\lib\nunit.engine.dll
- True
-
-
- ..\packages\NUnit3TestAdapter.3.4.1\lib\nunit.engine.api.dll
- True
-
-
- ..\packages\NUnit.3.4.1\lib\net45\nunit.framework.dll
- True
-
-
- ..\packages\NUnit3TestAdapter.3.4.1\lib\NUnit3.TestAdapter.dll
+
+ ..\packages\NUnit.3.6.0\lib\net45\nunit.framework.dll
True
@@ -111,6 +83,7 @@
+
@@ -120,11 +93,13 @@
+
+
diff --git a/src/GitVersionCore.Tests/IntegrationTests/DevelopScenarios.cs b/src/GitVersionCore.Tests/IntegrationTests/DevelopScenarios.cs
index b3c5f3f3fd..7964323934 100644
--- a/src/GitVersionCore.Tests/IntegrationTests/DevelopScenarios.cs
+++ b/src/GitVersionCore.Tests/IntegrationTests/DevelopScenarios.cs
@@ -178,7 +178,7 @@ public void InheritVersionFromReleaseBranch()
fixture.AssertFullSemver("2.1.0-alpha.4");
fixture.BranchTo("feature/MyFeature");
fixture.MakeACommit();
- fixture.AssertFullSemver("2.1.0-MyFeature.1+3");
+ fixture.AssertFullSemver("2.1.0-MyFeature.1+5");
}
}
}
\ No newline at end of file
diff --git a/src/GitVersionCore.Tests/IntegrationTests/FileSystemTests.cs b/src/GitVersionCore.Tests/IntegrationTests/FileSystemTests.cs
new file mode 100644
index 0000000000..b047022b24
--- /dev/null
+++ b/src/GitVersionCore.Tests/IntegrationTests/FileSystemTests.cs
@@ -0,0 +1,68 @@
+using System.IO;
+using System.Text;
+
+using GitVersion.Helpers;
+
+using NUnit.Framework;
+
+using Shouldly;
+
+[TestFixture]
+public class FileSystemTests
+{
+ public string TempFilePath { get; set; }
+
+ [SetUp]
+ public void CreateTempFile()
+ {
+ TempFilePath = Path.GetTempFileName();
+ }
+
+ [TearDown]
+ public void Cleanup()
+ {
+ File.Delete(TempFilePath);
+ }
+
+ [TestCase("utf-32")]
+ [TestCase("utf-32BE")]
+ [TestCase("utf-16")]
+ [TestCase("utf-16BE")]
+ [TestCase("utf-8")]
+ public void WhenFileExistsWithEncodingPreamble_EncodingIsPreservedAfterWriteAll(string encodingName)
+ {
+ var encoding = Encoding.GetEncoding(encodingName);
+
+ File.WriteAllText(TempFilePath, "(-‸ლ)", encoding);
+
+ var fileSystem = new FileSystem();
+ fileSystem.WriteAllText(TempFilePath, @"¯\(◉◡◔)/¯");
+
+ using (var stream = File.OpenRead(TempFilePath))
+ {
+ var preamble = encoding.GetPreamble();
+ var bytes = new byte[preamble.Length];
+ stream.Read(bytes, 0, preamble.Length);
+
+ bytes.ShouldBe(preamble);
+ }
+ }
+
+ [Test]
+ public void WhenFileDoesNotExist_CreateWithUTF8WithPreamble()
+ {
+ var encoding = Encoding.UTF8;
+
+ var fileSystem = new FileSystem();
+ fileSystem.WriteAllText(TempFilePath, "╚(ಠ_ಠ)=┐");
+
+ using (var stream = File.OpenRead(TempFilePath))
+ {
+ var preamble = encoding.GetPreamble();
+ var bytes = new byte[preamble.Length];
+ stream.Read(bytes, 0, preamble.Length);
+
+ bytes.ShouldBe(preamble);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/GitVersionCore.Tests/IntegrationTests/ReleaseBranchScenarios.cs b/src/GitVersionCore.Tests/IntegrationTests/ReleaseBranchScenarios.cs
index 2342adba30..7e1c9d4a3d 100644
--- a/src/GitVersionCore.Tests/IntegrationTests/ReleaseBranchScenarios.cs
+++ b/src/GitVersionCore.Tests/IntegrationTests/ReleaseBranchScenarios.cs
@@ -1,4 +1,8 @@
-using GitTools.Testing;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using GitTools;
+using GitTools.Testing;
using GitVersion;
using GitVersionCore.Tests;
using LibGit2Sharp;
@@ -225,7 +229,7 @@ public void WhenReleaseBranchIsMergedIntoDevelopHighestVersionIsTakenWithIt()
Commands.Checkout(fixture.Repository, "develop");
fixture.Repository.MergeNoFF("release-1.0.0", Generate.SignatureNow());
- fixture.AssertFullSemver("2.1.0-alpha.6");
+ fixture.AssertFullSemver("2.1.0-alpha.11");
}
}
@@ -329,6 +333,7 @@ public void HotfixOffReleaseBranchShouldNotResetCount()
fixture.AssertFullSemver(config, "2.0.0-beta.7");
}
}
+
[Test]
public void MergeOnReleaseBranchShouldNotResetCount()
{
@@ -360,4 +365,105 @@ public void MergeOnReleaseBranchShouldNotResetCount()
fixture.AssertFullSemver(config, "2.0.0-beta.2");
}
}
+
+ [Test]
+ public void CommitOnDevelop_AfterReleaseBranchMergeToDevelop_ShouldNotResetCount()
+ {
+ var config = new Config
+ {
+ VersioningMode = VersioningMode.ContinuousDeployment
+ };
+
+ using (var fixture = new EmptyRepositoryFixture())
+ {
+ fixture.Repository.MakeACommit("initial");
+ fixture.Repository.CreateBranch("develop");
+ Commands.Checkout(fixture.Repository, "develop");
+
+ // Create release from develop
+ fixture.Repository.CreateBranch("release-2.0.0");
+ Commands.Checkout(fixture.Repository, "release-2.0.0");
+ fixture.AssertFullSemver(config, "2.0.0-beta.0");
+
+ // Make some commits on release
+ fixture.Repository.MakeACommit("release 1");
+ fixture.Repository.MakeACommit("release 2");
+ fixture.AssertFullSemver(config, "2.0.0-beta.2");
+
+ // First merge release to develop
+ Commands.Checkout(fixture.Repository, "develop");
+ fixture.Repository.MergeNoFF("release-2.0.0", Generate.SignatureNow());
+
+ // Make some new commit on release
+ Commands.Checkout(fixture.Repository, "release-2.0.0");
+ fixture.Repository.MakeACommit("release 3 - after first merge");
+ fixture.AssertFullSemver(config, "2.0.0-beta.3");
+
+ // Make new commit on develop
+ Commands.Checkout(fixture.Repository, "develop");
+ fixture.Repository.MakeACommit("develop after merge");
+
+ // Checkout to release (no new commits)
+ Commands.Checkout(fixture.Repository, "release-2.0.0");
+ fixture.AssertFullSemver(config, "2.0.0-beta.3");
+
+ // Make some new commit on release
+ fixture.Repository.MakeACommit("release 4");
+ fixture.Repository.MakeACommit("release 5");
+ fixture.AssertFullSemver(config, "2.0.0-beta.5");
+
+ // Second merge release to develop
+ Commands.Checkout(fixture.Repository, "develop");
+ fixture.Repository.MergeNoFF("release-2.0.0", Generate.SignatureNow());
+
+ // Checkout to release (no new commits)
+ Commands.Checkout(fixture.Repository, "release-2.0.0");
+ fixture.AssertFullSemver(config, "2.0.0-beta.5");
+ }
+ }
+
+ public void ReleaseBranchShouldUseBranchNameVersionDespiteBumpInPreviousCommit()
+ {
+ using (var fixture = new EmptyRepositoryFixture())
+ {
+ fixture.Repository.MakeATaggedCommit("1.0");
+ fixture.Repository.MakeACommit("+semver:major");
+ fixture.Repository.MakeACommit();
+
+ Commands.Checkout(fixture.Repository, fixture.Repository.CreateBranch("release/2.0"));
+
+ fixture.AssertFullSemver("2.0.0-beta.1+2");
+ }
+ }
+
+ [Test]
+ public void ReleaseBranchWithACommitShouldUseBranchNameVersionDespiteBumpInPreviousCommit()
+ {
+ using (var fixture = new EmptyRepositoryFixture())
+ {
+ fixture.Repository.MakeATaggedCommit("1.0");
+ fixture.Repository.MakeACommit("+semver:major");
+ fixture.Repository.MakeACommit();
+
+ Commands.Checkout(fixture.Repository, fixture.Repository.CreateBranch("release/2.0"));
+
+ fixture.Repository.MakeACommit();
+
+ fixture.AssertFullSemver("2.0.0-beta.1+3");
+ }
+ }
+
+ [Test]
+ public void ReleaseBranchedAtCommitWithSemverMessageShouldUseBranchNameVersion()
+ {
+ using (var fixture = new EmptyRepositoryFixture())
+ {
+ fixture.Repository.MakeATaggedCommit("1.0");
+ fixture.Repository.MakeACommit("+semver:major");
+
+ Commands.Checkout(fixture.Repository, fixture.Repository.CreateBranch("release/2.0"));
+
+ fixture.AssertFullSemver("2.0.0-beta.1+1");
+ }
+ }
}
\ No newline at end of file
diff --git a/src/GitVersionCore.Tests/TestEffectiveConfiguration.cs b/src/GitVersionCore.Tests/TestEffectiveConfiguration.cs
index c2fa33b310..3256c2d90e 100644
--- a/src/GitVersionCore.Tests/TestEffectiveConfiguration.cs
+++ b/src/GitVersionCore.Tests/TestEffectiveConfiguration.cs
@@ -9,6 +9,7 @@ public class TestEffectiveConfiguration : EffectiveConfiguration
{
public TestEffectiveConfiguration(
AssemblyVersioningScheme assemblyVersioningScheme = AssemblyVersioningScheme.MajorMinorPatch,
+ AssemblyFileVersioningScheme assemblyFileVersioningScheme = AssemblyFileVersioningScheme.MajorMinorPatch,
string assemblyInformationalFormat = null,
VersioningMode versioningMode = VersioningMode.ContinuousDelivery,
string gitTagPrefix = "v",
@@ -30,7 +31,7 @@ public TestEffectiveConfiguration(
IEnumerable versionFilters = null,
bool tracksReleaseBranches = false,
bool isRelease = false) :
- base(assemblyVersioningScheme, assemblyInformationalFormat, versioningMode, gitTagPrefix, tag, nextVersion, IncrementStrategy.Patch,
+ base(assemblyVersioningScheme, assemblyFileVersioningScheme, assemblyInformationalFormat, versioningMode, gitTagPrefix, tag, nextVersion, IncrementStrategy.Patch,
branchPrefixToTrim, preventIncrementForMergedBranchVersion, tagNumberPattern, continuousDeploymentFallbackTag,
trackMergeTarget,
majorMessage, minorMessage, patchMessage, noBumpMessage,
diff --git a/src/GitVersionCore.Tests/TestFileSystem.cs b/src/GitVersionCore.Tests/TestFileSystem.cs
index f78d9c890c..217957b015 100644
--- a/src/GitVersionCore.Tests/TestFileSystem.cs
+++ b/src/GitVersionCore.Tests/TestFileSystem.cs
@@ -7,7 +7,7 @@
public class TestFileSystem : IFileSystem
{
- Dictionary fileSystem = new Dictionary();
+ Dictionary fileSystem = new Dictionary();
public void Copy(string @from, string to, bool overwrite)
{
@@ -19,7 +19,7 @@ public void Copy(string @from, string to, bool overwrite)
throw new IOException("File already exists");
}
- string source;
+ byte[] source;
if (!fileSystem.TryGetValue(from, out source))
throw new FileNotFoundException(string.Format("The source file '{0}' was not found", from), from);
@@ -44,19 +44,25 @@ public void Delete(string path)
public string ReadAllText(string path)
{
- return fileSystem[path];
+ byte[] content;
+ if (!fileSystem.TryGetValue(path, out content))
+ throw new FileNotFoundException(string.Format("The file '{0}' was not found", path), path);
+
+ var encoding = EncodingHelper.DetectEncoding(content) ?? Encoding.UTF8;
+ return encoding.GetString(content);
}
public void WriteAllText(string file, string fileContents)
{
- if (fileSystem.ContainsKey(file))
- {
- fileSystem[file] = fileContents;
- }
- else
- {
- fileSystem.Add(file, fileContents);
- }
+ var encoding = fileSystem.ContainsKey(file)
+ ? EncodingHelper.DetectEncoding(fileSystem[file]) ?? Encoding.UTF8
+ : Encoding.UTF8;
+ WriteAllText(file, fileContents, encoding);
+ }
+
+ public void WriteAllText(string file, string fileContents, Encoding encoding)
+ {
+ fileSystem[file] = encoding.GetBytes(fileContents);
}
public IEnumerable DirectoryGetFiles(string directory, string searchPattern, SearchOption searchOption)
@@ -74,7 +80,7 @@ public Stream OpenRead(string path)
if (fileSystem.ContainsKey(path))
{
var content = fileSystem[path];
- return new MemoryStream(Encoding.UTF8.GetBytes(content));
+ return new MemoryStream(content);
}
throw new FileNotFoundException("File not found.", path);
@@ -84,11 +90,11 @@ public void CreateDirectory(string path)
{
if (fileSystem.ContainsKey(path))
{
- fileSystem[path] = "";
+ fileSystem[path] = new byte[0];
}
else
{
- fileSystem.Add(path, "");
+ fileSystem.Add(path, new byte[0]);
}
}
diff --git a/src/GitVersionCore.Tests/TestableVersionVariables.cs b/src/GitVersionCore.Tests/TestableVersionVariables.cs
index e09bc7fc62..5f2ba8e64d 100644
--- a/src/GitVersionCore.Tests/TestableVersionVariables.cs
+++ b/src/GitVersionCore.Tests/TestableVersionVariables.cs
@@ -4,7 +4,7 @@
class TestableVersionVariables : VersionVariables
{
- public TestableVersionVariables(string major = "", string minor = "", string patch = "", string buildMetaData = "", string buildMetaDataPadded = "", string fullBuildMetaData = "", string branchName = "", string sha = "", string majorMinorPatch = "", string semVer = "", string legacySemVer = "", string legacySemVerPadded = "", string fullSemVer = "", string assemblySemVer = "", string preReleaseTag = "", string preReleaseTagWithDash = "", string preReleaseLabel = "", string preReleaseNumber = "", string informationalVersion = "", string commitDate = "", string nugetVersion = "", string nugetVersionV2 = "", string nugetPreReleaseTag = "", string nugetPreReleaseTagV2 = "", string commitsSinceVersionSource = "", string commitsSinceVersionSourcePadded = "") : base(major, minor, patch, buildMetaData, buildMetaDataPadded, fullBuildMetaData, branchName, sha, majorMinorPatch, semVer, legacySemVer, legacySemVerPadded, fullSemVer, assemblySemVer, preReleaseTag, preReleaseTagWithDash, preReleaseLabel, preReleaseNumber, informationalVersion, commitDate, nugetVersion, nugetVersionV2, nugetPreReleaseTag, nugetPreReleaseTagV2, commitsSinceVersionSource, commitsSinceVersionSourcePadded)
+ public TestableVersionVariables(string major = "", string minor = "", string patch = "", string buildMetaData = "", string buildMetaDataPadded = "", string fullBuildMetaData = "", string branchName = "", string sha = "", string majorMinorPatch = "", string semVer = "", string legacySemVer = "", string legacySemVerPadded = "", string fullSemVer = "", string assemblySemVer = "", string assemblySemFileVer = "", string preReleaseTag = "", string preReleaseTagWithDash = "", string preReleaseLabel = "", string preReleaseNumber = "", string informationalVersion = "", string commitDate = "", string nugetVersion = "", string nugetVersionV2 = "", string nugetPreReleaseTag = "", string nugetPreReleaseTagV2 = "", string commitsSinceVersionSource = "", string commitsSinceVersionSourcePadded = "") : base(major, minor, patch, buildMetaData, buildMetaDataPadded, fullBuildMetaData, branchName, sha, majorMinorPatch, semVer, legacySemVer, legacySemVerPadded, fullSemVer, assemblySemVer, assemblySemFileVer, preReleaseTag, preReleaseTagWithDash, preReleaseLabel, preReleaseNumber, informationalVersion, commitDate, nugetVersion, nugetVersionV2, nugetPreReleaseTag, nugetPreReleaseTagV2, commitsSinceVersionSource, commitsSinceVersionSourcePadded)
{
}
}
diff --git a/src/GitVersionCore.Tests/packages.config b/src/GitVersionCore.Tests/packages.config
index b891f30665..b39b789fc0 100644
--- a/src/GitVersionCore.Tests/packages.config
+++ b/src/GitVersionCore.Tests/packages.config
@@ -8,8 +8,8 @@
-
-
+
+
diff --git a/src/GitVersionCore/AssemblyFileVersioningScheme.cs b/src/GitVersionCore/AssemblyFileVersioningScheme.cs
new file mode 100644
index 0000000000..5e3a7887a3
--- /dev/null
+++ b/src/GitVersionCore/AssemblyFileVersioningScheme.cs
@@ -0,0 +1,11 @@
+namespace GitVersion
+{
+ public enum AssemblyFileVersioningScheme
+ {
+ MajorMinorPatchTag,
+ MajorMinorPatch,
+ MajorMinor,
+ Major,
+ None
+ }
+}
diff --git a/src/GitVersionCore/AssemblyVersionsGenerator.cs b/src/GitVersionCore/AssemblyVersionsGenerator.cs
index 7fbf5778a6..f0ed07b73e 100644
--- a/src/GitVersionCore/AssemblyVersionsGenerator.cs
+++ b/src/GitVersionCore/AssemblyVersionsGenerator.cs
@@ -24,5 +24,26 @@ public static string GetAssemblyVersion(
throw new ArgumentException(string.Format("Unexpected value ({0}).", scheme), "scheme");
}
}
+
+ public static string GetAssemblyFileVersion(
+ this SemanticVersion sv,
+ AssemblyFileVersioningScheme scheme)
+ {
+ switch (scheme)
+ {
+ case AssemblyFileVersioningScheme.Major:
+ return string.Format("{0}.0.0.0", sv.Major);
+ case AssemblyFileVersioningScheme.MajorMinor:
+ return string.Format("{0}.{1}.0.0", sv.Major, sv.Minor);
+ case AssemblyFileVersioningScheme.MajorMinorPatch:
+ return string.Format("{0}.{1}.{2}.0", sv.Major, sv.Minor, sv.Patch);
+ case AssemblyFileVersioningScheme.MajorMinorPatchTag:
+ return string.Format("{0}.{1}.{2}.{3}", sv.Major, sv.Minor, sv.Patch, sv.PreReleaseTag.Number ?? 0);
+ case AssemblyFileVersioningScheme.None:
+ return null;
+ default:
+ throw new ArgumentException(string.Format("Unexpected value ({0}).", scheme), "scheme");
+ }
+ }
}
}
\ No newline at end of file
diff --git a/src/GitVersionCore/BuildServers/AppVeyor.cs b/src/GitVersionCore/BuildServers/AppVeyor.cs
index 63d2a8d456..619f6d81e2 100644
--- a/src/GitVersionCore/BuildServers/AppVeyor.cs
+++ b/src/GitVersionCore/BuildServers/AppVeyor.cs
@@ -6,11 +6,11 @@
public class AppVeyor : BuildServerBase
{
- public const string EnvironmentVariableName = "APPVEYOR";
+ public const string EnvironmentVariableName = "APPVEYOR";
- public override bool CanApplyToCurrentContext()
+ public override bool CanApplyToCurrentContext()
{
- return !string.IsNullOrEmpty(Environment.GetEnvironmentVariable(EnvironmentVariableName));
+ return !string.IsNullOrEmpty(Environment.GetEnvironmentVariable(EnvironmentVariableName));
}
public override string GenerateSetVersionMessage(VersionVariables variables)
diff --git a/src/GitVersionCore/BuildServers/BuildServerList.cs b/src/GitVersionCore/BuildServers/BuildServerList.cs
index 5877c3be1a..dcd4f6f5a8 100644
--- a/src/GitVersionCore/BuildServers/BuildServerList.cs
+++ b/src/GitVersionCore/BuildServers/BuildServerList.cs
@@ -14,7 +14,7 @@ public static class BuildServerList
new Jenkins(),
new GitLabCi(),
new VsoAgent(),
- new TravisCI(),
+ new TravisCI(),
};
public static IEnumerable GetApplicableBuildServers()
diff --git a/src/GitVersionCore/BuildServers/TeamCity.cs b/src/GitVersionCore/BuildServers/TeamCity.cs
index 3dfd13a1ba..e8b3e0bee8 100644
--- a/src/GitVersionCore/BuildServers/TeamCity.cs
+++ b/src/GitVersionCore/BuildServers/TeamCity.cs
@@ -4,11 +4,11 @@
public class TeamCity : BuildServerBase
{
- public const string EnvironmentVariableName = "TEAMCITY_VERSION";
+ public const string EnvironmentVariableName = "TEAMCITY_VERSION";
- public override bool CanApplyToCurrentContext()
+ public override bool CanApplyToCurrentContext()
{
- return !string.IsNullOrEmpty(Environment.GetEnvironmentVariable(EnvironmentVariableName));
+ return !string.IsNullOrEmpty(Environment.GetEnvironmentVariable(EnvironmentVariableName));
}
public override string GetCurrentBranch(bool usingDynamicRepos)
diff --git a/src/GitVersionCore/BuildServers/TravisCI.cs b/src/GitVersionCore/BuildServers/TravisCI.cs
index 5deed8c6d6..097b62d3b5 100644
--- a/src/GitVersionCore/BuildServers/TravisCI.cs
+++ b/src/GitVersionCore/BuildServers/TravisCI.cs
@@ -1,32 +1,32 @@
using System;
namespace GitVersion
{
- public class TravisCI : BuildServerBase
- {
- public const string EnvironmentVariableName = "TRAVIS";
+ public class TravisCI : BuildServerBase
+ {
+ public const string EnvironmentVariableName = "TRAVIS";
- public override bool CanApplyToCurrentContext ()
- {
- return "true".Equals(Environment.GetEnvironmentVariable(EnvironmentVariableName)) && "true".Equals(Environment.GetEnvironmentVariable("CI"));
- }
+ public override bool CanApplyToCurrentContext ()
+ {
+ return "true".Equals(Environment.GetEnvironmentVariable(EnvironmentVariableName)) && "true".Equals(Environment.GetEnvironmentVariable("CI"));
+ }
- public override string GenerateSetVersionMessage(VersionVariables variables)
- {
- return variables.FullSemVer;
- }
+ public override string GenerateSetVersionMessage(VersionVariables variables)
+ {
+ return variables.FullSemVer;
+ }
- public override string[] GenerateSetParameterMessage(string name, string value)
- {
- return new[]
- {
- string.Format("GitVersion_{0}={1}", name, value)
- };
- }
+ public override string[] GenerateSetParameterMessage(string name, string value)
+ {
+ return new[]
+ {
+ string.Format("GitVersion_{0}={1}", name, value)
+ };
+ }
- public override bool PreventFetch ()
- {
- return true;
- }
- }
+ public override bool PreventFetch ()
+ {
+ return true;
+ }
+ }
}
diff --git a/src/GitVersionCore/Configuration/Config.cs b/src/GitVersionCore/Configuration/Config.cs
index a0dd35c832..8cd94e083c 100644
--- a/src/GitVersionCore/Configuration/Config.cs
+++ b/src/GitVersionCore/Configuration/Config.cs
@@ -18,6 +18,9 @@ public Config()
[YamlMember(Alias = "assembly-versioning-scheme")]
public AssemblyVersioningScheme? AssemblyVersioningScheme { get; set; }
+ [YamlMember(Alias = "assembly-file-versioning-scheme")]
+ public AssemblyFileVersioningScheme? AssemblyFileVersioningScheme { get; set; }
+
[YamlMember(Alias = "assembly-informational-format")]
public string AssemblyInformationalFormat { get; set; }
diff --git a/src/GitVersionCore/Configuration/ConfigurationProvider.cs b/src/GitVersionCore/Configuration/ConfigurationProvider.cs
index 3d803d3fd3..d293417646 100644
--- a/src/GitVersionCore/Configuration/ConfigurationProvider.cs
+++ b/src/GitVersionCore/Configuration/ConfigurationProvider.cs
@@ -85,6 +85,7 @@ This is because mainline mode treats your entire git repository as an event sour
public static void ApplyDefaultsTo(Config config)
{
config.AssemblyVersioningScheme = config.AssemblyVersioningScheme ?? AssemblyVersioningScheme.MajorMinorPatch;
+ config.AssemblyFileVersioningScheme = config.AssemblyFileVersioningScheme ?? AssemblyFileVersioningScheme.MajorMinorPatch;
config.AssemblyInformationalFormat = config.AssemblyInformationalFormat;
config.TagPrefix = config.TagPrefix ?? DefaultTagPrefix;
config.VersioningMode = config.VersioningMode ?? VersioningMode.ContinuousDelivery;
@@ -229,6 +230,13 @@ public static string GetEffectiveConfigAsString(string workingDirectory, IFileSy
public static void Verify(GitPreparer gitPreparer, IFileSystem fileSystem)
{
+ if (!string.IsNullOrWhiteSpace(gitPreparer.TargetUrl))
+ {
+ // Assuming this is a dynamic repository. At this stage it's unsure whether we have
+ // any .git info so we need to skip verification
+ return;
+ }
+
var workingDirectory = gitPreparer.WorkingDirectory;
var projectRootDirectory = gitPreparer.GetProjectRootDirectory();
diff --git a/src/GitVersionCore/EffectiveConfiguration.cs b/src/GitVersionCore/EffectiveConfiguration.cs
index 0cdd90747e..a33af8b1b8 100644
--- a/src/GitVersionCore/EffectiveConfiguration.cs
+++ b/src/GitVersionCore/EffectiveConfiguration.cs
@@ -10,6 +10,7 @@ public class EffectiveConfiguration
{
public EffectiveConfiguration(
AssemblyVersioningScheme assemblyVersioningScheme,
+ AssemblyFileVersioningScheme assemblyFileVersioningScheme,
string assemblyInformationalFormat,
VersioningMode versioningMode, string gitTagPrefix,
string tag, string nextVersion, IncrementStrategy increment,
@@ -31,6 +32,7 @@ public EffectiveConfiguration(
bool isCurrentBranchRelease)
{
AssemblyVersioningScheme = assemblyVersioningScheme;
+ AssemblyFileVersioningScheme = assemblyFileVersioningScheme;
AssemblyInformationalFormat = assemblyInformationalFormat;
VersioningMode = versioningMode;
GitTagPrefix = gitTagPrefix;
@@ -61,6 +63,7 @@ public EffectiveConfiguration(
public VersioningMode VersioningMode { get; private set; }
public AssemblyVersioningScheme AssemblyVersioningScheme { get; private set; }
+ public AssemblyFileVersioningScheme AssemblyFileVersioningScheme { get; private set; }
public string AssemblyInformationalFormat { get; private set; }
///
diff --git a/src/GitVersionCore/GitPreparer.cs b/src/GitVersionCore/GitPreparer.cs
index 4bda46e1a9..29fa177a50 100644
--- a/src/GitVersionCore/GitPreparer.cs
+++ b/src/GitVersionCore/GitPreparer.cs
@@ -4,6 +4,7 @@ namespace GitVersion
using System.IO;
using System.Linq;
using GitTools.Git;
+ using GitTools.Logging;
using LibGit2Sharp;
public class GitPreparer
@@ -28,6 +29,14 @@ public GitPreparer(string targetUrl, string dynamicRepositoryLocation, Authentic
};
this.noFetch = noFetch;
this.targetPath = targetPath.TrimEnd('/', '\\');
+
+ // GitTools has its own logging. So that it actually outputs something, it needs to be initialized.
+ LogProvider.SetCurrentLogProvider(new LoggerWrapper());
+ }
+
+ public string TargetUrl
+ {
+ get { return targetUrl; }
}
public string WorkingDirectory
@@ -48,7 +57,10 @@ public void Initialise(bool normaliseGitDirectory, string currentBranch)
{
if (normaliseGitDirectory)
{
- GitRepositoryHelper.NormalizeGitDirectory(GetDotGitDirectory(), authentication, noFetch, currentBranch);
+ using (Logger.IndentLog(string.Format("Normalizing git directory for branch '{0}'", currentBranch)))
+ {
+ GitRepositoryHelper.NormalizeGitDirectory(GetDotGitDirectory(), authentication, noFetch, currentBranch);
+ }
}
return;
}
@@ -144,50 +156,65 @@ static string CreateDynamicRepository(string targetPath, AuthenticationInfo auth
{
throw new Exception("Dynamic Git repositories must have a target branch (/b)");
}
- Logger.WriteInfo(string.Format("Creating dynamic repository at '{0}'", targetPath));
- var gitDirectory = Path.Combine(targetPath, ".git");
- if (Directory.Exists(targetPath))
+ using (Logger.IndentLog(string.Format("Creating dynamic repository at '{0}'", targetPath)))
{
- Logger.WriteInfo("Git repository already exists");
- GitRepositoryHelper.NormalizeGitDirectory(gitDirectory, authentication, noFetch, targetBranch);
+ var gitDirectory = Path.Combine(targetPath, ".git");
+ if (Directory.Exists(targetPath))
+ {
+ Logger.WriteInfo("Git repository already exists");
+ using (Logger.IndentLog(string.Format("Normalizing git directory for branch '{0}'", targetBranch)))
+ {
+ GitRepositoryHelper.NormalizeGitDirectory(gitDirectory, authentication, noFetch, targetBranch);
+ }
- return gitDirectory;
- }
+ return gitDirectory;
+ }
- CloneRepository(repositoryUrl, gitDirectory, authentication);
+ CloneRepository(repositoryUrl, gitDirectory, authentication);
- // Normalize (download branches) before using the branch
- GitRepositoryHelper.NormalizeGitDirectory(gitDirectory, authentication, noFetch, targetBranch);
+ using (Logger.IndentLog(string.Format("Normalizing git directory for branch '{0}'", targetBranch)))
+ {
+ // Normalize (download branches) before using the branch
+ GitRepositoryHelper.NormalizeGitDirectory(gitDirectory, authentication, noFetch, targetBranch);
+ }
- return gitDirectory;
+ return gitDirectory;
+ }
}
static void CloneRepository(string repositoryUrl, string gitDirectory, AuthenticationInfo authentication)
{
Credentials credentials = null;
- if (!string.IsNullOrWhiteSpace(authentication.Username) && !string.IsNullOrWhiteSpace(authentication.Password))
- {
- Logger.WriteInfo(string.Format("Setting up credentials using name '{0}'", authentication.Username));
- credentials = new UsernamePasswordCredentials
+ if (authentication != null)
+ {
+ if (!string.IsNullOrWhiteSpace(authentication.Username) && !string.IsNullOrWhiteSpace(authentication.Password))
{
- Username = authentication.Username,
- Password = authentication.Password
- };
+ Logger.WriteInfo(string.Format("Setting up credentials using name '{0}'", authentication.Username));
+
+ credentials = new UsernamePasswordCredentials
+ {
+ Username = authentication.Username,
+ Password = authentication.Password
+ };
+ }
}
- Logger.WriteInfo(string.Format("Retrieving git info from url '{0}'", repositoryUrl));
try
{
- var cloneOptions = new CloneOptions
+ using (Logger.IndentLog(string.Format("Cloning repository from url '{0}'", repositoryUrl)))
{
- Checkout = false,
- CredentialsProvider = (url, usernameFromUrl, types) => credentials
- };
- var returnedPath = Repository.Clone(repositoryUrl, gitDirectory, cloneOptions);
- Logger.WriteInfo(string.Format("Returned path after repository clone: {0}", returnedPath));
+ var cloneOptions = new CloneOptions
+ {
+ Checkout = false,
+ CredentialsProvider = (url, usernameFromUrl, types) => credentials
+ };
+
+ var returnedPath = Repository.Clone(repositoryUrl, gitDirectory, cloneOptions);
+ Logger.WriteInfo(string.Format("Returned path after repository clone: {0}", returnedPath));
+ }
}
catch (LibGit2SharpException ex)
{
diff --git a/src/GitVersionCore/GitRepoMetadataProvider.cs b/src/GitVersionCore/GitRepoMetadataProvider.cs
index 4f329e22f9..f9aa811506 100644
--- a/src/GitVersionCore/GitRepoMetadataProvider.cs
+++ b/src/GitVersionCore/GitRepoMetadataProvider.cs
@@ -133,26 +133,23 @@ public Commit FindMergeBase(Branch branch, Branch otherBranch)
{
Logger.WriteInfo(string.Format("Found merge base of {0}", findMergeBase.Sha));
// We do not want to include merge base commits which got forward merged into the other branch
- bool mergeBaseWasForwardMerge;
+ Commit mergeBaseAsForwardMerge;
do
{
// Now make sure that the merge base is not a forward merge
- mergeBaseWasForwardMerge = otherBranch.Commits
+ mergeBaseAsForwardMerge = otherBranch.Commits
.SkipWhile(c => c != commitToFindCommonBase)
.TakeWhile(c => c != findMergeBase)
- .Any(c => c.Parents.Contains(findMergeBase));
- if (mergeBaseWasForwardMerge)
+ .LastOrDefault(c => c.Parents.Contains(findMergeBase));
+
+ if (mergeBaseAsForwardMerge != null)
{
- var second = commitToFindCommonBase.Parents.First();
- var mergeBase = this.Repository.ObjectDatabase.FindMergeBase(commit, second);
- if (mergeBase == findMergeBase)
- {
- break;
- }
- findMergeBase = mergeBase;
+ commitToFindCommonBase = mergeBaseAsForwardMerge.Parents.First();
+ findMergeBase = this.Repository.ObjectDatabase.FindMergeBase(commit, commitToFindCommonBase);
+
Logger.WriteInfo(string.Format("Merge base was due to a forward merge, next merge base is {0}", findMergeBase));
}
- } while (mergeBaseWasForwardMerge);
+ } while (mergeBaseAsForwardMerge != null);
}
// Store in cache.
diff --git a/src/GitVersionCore/GitVersionContext.cs b/src/GitVersionCore/GitVersionContext.cs
index 1b5f57e195..d7a1ed5418 100644
--- a/src/GitVersionCore/GitVersionContext.cs
+++ b/src/GitVersionCore/GitVersionContext.cs
@@ -100,6 +100,8 @@ void CalculateEffectiveConfiguration()
if (!FullConfiguration.AssemblyVersioningScheme.HasValue)
throw new Exception("Configuration value for 'AssemblyVersioningScheme' has no value. (this should not happen, please report an issue)");
+ if (!FullConfiguration.AssemblyFileVersioningScheme.HasValue)
+ throw new Exception("Configuration value for 'AssemblyFileVersioningScheme' has no value. (this should not happen, please report an issue)");
if (!FullConfiguration.CommitMessageIncrementing.HasValue)
throw new Exception("Configuration value for 'CommitMessageIncrementing' has no value. (this should not happen, please report an issue)");
if (!FullConfiguration.LegacySemVerPadding.HasValue)
@@ -118,6 +120,7 @@ void CalculateEffectiveConfiguration()
var nextVersion = FullConfiguration.NextVersion;
var assemblyVersioningScheme = FullConfiguration.AssemblyVersioningScheme.Value;
+ var assemblyFileVersioningScheme = FullConfiguration.AssemblyFileVersioningScheme.Value;
var assemblyInformationalFormat = FullConfiguration.AssemblyInformationalFormat;
var gitTagPrefix = FullConfiguration.TagPrefix;
var majorMessage = FullConfiguration.MajorVersionBumpMessage;
@@ -128,7 +131,7 @@ void CalculateEffectiveConfiguration()
var commitMessageVersionBump = currentBranchConfig.CommitMessageIncrementing ?? FullConfiguration.CommitMessageIncrementing.Value;
Configuration = new EffectiveConfiguration(
- assemblyVersioningScheme, assemblyInformationalFormat, versioningMode, gitTagPrefix,
+ assemblyVersioningScheme, assemblyFileVersioningScheme, assemblyInformationalFormat, versioningMode, gitTagPrefix,
tag, nextVersion, incrementStrategy,
currentBranchConfig.Regex,
preventIncrementForMergedBranchVersion,
diff --git a/src/GitVersionCore/GitVersionCore.csproj b/src/GitVersionCore/GitVersionCore.csproj
index ef715fea33..a995447133 100644
--- a/src/GitVersionCore/GitVersionCore.csproj
+++ b/src/GitVersionCore/GitVersionCore.csproj
@@ -11,7 +11,7 @@
GitVersion
GitVersionCore
v4.0
- 5
+ 6
512
$(SolutionDir)..\build\
@@ -43,8 +43,8 @@
..\packages\GitTools.Core.1.2.1-beta0001\lib\net4\GitTools.Core.dll
True
-
- ..\packages\JetBrainsAnnotations.Fody.1.0.4.0\Lib\JetBrains.Annotations.dll
+
+ ..\packages\JetBrainsAnnotations.Fody.1.0.5.0\lib\JetBrains.Annotations.dll
False
@@ -69,6 +69,7 @@
+
@@ -126,6 +127,7 @@
+
@@ -133,6 +135,7 @@
+
diff --git a/src/GitVersionCore/GitVersionFinder.cs b/src/GitVersionCore/GitVersionFinder.cs
index 4163d23a62..77addc07c1 100644
--- a/src/GitVersionCore/GitVersionFinder.cs
+++ b/src/GitVersionCore/GitVersionFinder.cs
@@ -12,6 +12,11 @@ public SemanticVersion FindVersion(GitVersionContext context)
"Running against branch: {0} ({1})",
context.CurrentBranch.FriendlyName,
context.CurrentCommit == null ? "-" : context.CurrentCommit.Sha));
+ if (context.IsCurrentCommitTagged)
+ {
+ Logger.WriteInfo($"Current commit is tagged with version {context.CurrentCommitTaggedVersion}, " +
+ "version calcuation is for metadata only.");
+ }
EnsureMainTopologyConstraints(context);
var filePath = Path.Combine(context.Repository.GetRepositoryDirectory(), "NextVersion.txt");
diff --git a/src/GitVersionCore/Helpers/EncodingHelper.cs b/src/GitVersionCore/Helpers/EncodingHelper.cs
new file mode 100644
index 0000000000..392f86e2ac
--- /dev/null
+++ b/src/GitVersionCore/Helpers/EncodingHelper.cs
@@ -0,0 +1,102 @@
+namespace GitVersion.Helpers
+{
+ using System.Collections.Generic;
+ using System.IO;
+ using System.Linq;
+ using System.Text;
+
+ public static class EncodingHelper
+ {
+ private static IList EncodingsWithPreambles;
+
+ private static int MaxPreambleLength;
+
+ ///
+ /// Detects the encoding of a file if and only if it includes a preamble .
+ ///
+ /// The file name to check the encoding of.
+ /// The encoding of the file if it has a preamble otherwise null.
+ public static Encoding DetectEncoding(string filename)
+ {
+ if (!File.Exists(filename))
+ {
+ return null;
+ }
+
+ if (EncodingsWithPreambles == null)
+ {
+ ScanEncodings();
+ }
+
+ using (var stream = File.OpenRead(filename))
+ {
+ // No bytes? No encoding!
+ if (stream.Length == 0)
+ {
+ return null;
+ }
+
+ // Read the minimum amount necessary.
+ var length = stream.Length > MaxPreambleLength ? MaxPreambleLength : stream.Length;
+
+ var bytes = new byte[length];
+ stream.Read(bytes, 0, (int)length);
+ return DetectEncoding(bytes);
+ }
+ }
+
+ ///
+ /// Returns the first encoding where all the preamble bytes match exactly.
+ ///
+ /// The bytes to check for a matching preamble.
+ /// The encoding that has a matching preamble or null if one was not found.
+ public static Encoding DetectEncoding(IList bytes)
+ {
+ if (bytes == null || bytes.Count == 0)
+ {
+ return null;
+ }
+
+ if (EncodingsWithPreambles == null)
+ {
+ ScanEncodings();
+ }
+
+ return EncodingsWithPreambles.FirstOrDefault(encoding => PreambleMatches(encoding, bytes));
+ }
+
+ ///
+ /// Returns an ordered list of encodings that have preambles ordered by the length of the
+ /// preamble longest to shortest. This prevents a short preamble masking a longer one
+ /// later in the list.
+ ///
+ /// An ordered list of encodings and corresponding preambles.
+ private static void ScanEncodings()
+ {
+ EncodingsWithPreambles = (from info in Encoding.GetEncodings()
+ let encoding = info.GetEncoding()
+ let preamble = encoding.GetPreamble()
+ where preamble.Length > 0
+ orderby preamble.Length descending
+ select encoding).ToList();
+
+ var encodingWithLongestPreamble = EncodingsWithPreambles.FirstOrDefault();
+ MaxPreambleLength = encodingWithLongestPreamble == null ? 0 : encodingWithLongestPreamble.GetPreamble().Length;
+ }
+
+ ///
+ /// Verifies that all bytes of an encoding's preamble are present at the beginning of some sample data.
+ ///
+ /// The encoding to check against.
+ /// The data to test.
+ /// A boolean indicating if a preamble match was found.
+ private static bool PreambleMatches(Encoding encoding, IList data)
+ {
+ var preamble = encoding.GetPreamble();
+ if (preamble.Length > data.Count)
+ return false;
+
+ return !preamble.Where((preambleByte, index) => data[index] != preambleByte).Any();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/GitVersionCore/Helpers/FileSystem.cs b/src/GitVersionCore/Helpers/FileSystem.cs
index 9bc62b5cdf..f3022e816c 100644
--- a/src/GitVersionCore/Helpers/FileSystem.cs
+++ b/src/GitVersionCore/Helpers/FileSystem.cs
@@ -4,6 +4,7 @@ namespace GitVersion.Helpers
using System.Collections.Generic;
using System.IO;
using System.Linq;
+ using System.Text;
public class FileSystem : IFileSystem
{
@@ -36,7 +37,15 @@ public string ReadAllText(string path)
public void WriteAllText(string file, string fileContents)
{
- File.WriteAllText(file, fileContents);
+ // Opinionated decision to use UTF8 with BOM when creating new files or when the existing
+ // encoding was not easily detected due to the file not having an encoding preamble.
+ var encoding = EncodingHelper.DetectEncoding(file) ?? Encoding.UTF8;
+ WriteAllText(file, fileContents, encoding);
+ }
+
+ public void WriteAllText(string file, string fileContents, Encoding encoding)
+ {
+ File.WriteAllText(file, fileContents, encoding);
}
public IEnumerable DirectoryGetFiles(string directory, string searchPattern, SearchOption searchOption)
diff --git a/src/GitVersionCore/Helpers/IFileSystem.cs b/src/GitVersionCore/Helpers/IFileSystem.cs
index edd1dc78ce..9a4f5e4272 100644
--- a/src/GitVersionCore/Helpers/IFileSystem.cs
+++ b/src/GitVersionCore/Helpers/IFileSystem.cs
@@ -2,6 +2,7 @@ namespace GitVersion.Helpers
{
using System.Collections.Generic;
using System.IO;
+ using System.Text;
public interface IFileSystem
{
@@ -11,6 +12,7 @@ public interface IFileSystem
void Delete(string path);
string ReadAllText(string path);
void WriteAllText(string file, string fileContents);
+ void WriteAllText(string file, string fileContents, Encoding encoding);
IEnumerable DirectoryGetFiles(string directory, string searchPattern, SearchOption searchOption);
Stream OpenWrite(string path);
Stream OpenRead(string path);
diff --git a/src/GitVersionCore/LoggerWrapper.cs b/src/GitVersionCore/LoggerWrapper.cs
new file mode 100644
index 0000000000..5c4489dc26
--- /dev/null
+++ b/src/GitVersionCore/LoggerWrapper.cs
@@ -0,0 +1,84 @@
+namespace GitVersion
+{
+ using System;
+ using GitTools.Logging;
+
+ ///
+ /// Wraps the for use by GitTools.
+ ///
+ public class LoggerWrapper : ILogProvider
+ {
+ public GitTools.Logging.Logger GetLogger(string name)
+ {
+ return Log;
+ }
+
+ public IDisposable OpenNestedContext(string message)
+ {
+ throw new NotImplementedException();
+ }
+
+ public IDisposable OpenMappedContext(string key, string value)
+ {
+ throw new NotImplementedException();
+ }
+
+ private static bool Log(LogLevel loglevel, Func messagefunc, Exception exception, object[] formatparameters)
+ {
+ // Create the main message. Careful of string format errors.
+ string message;
+ if (messagefunc == null)
+ {
+ message = null;
+ }
+ else
+ {
+ if (formatparameters == null || formatparameters.Length == 0)
+ {
+ message = messagefunc();
+ }
+ else
+ {
+ try
+ {
+ message = string.Format(messagefunc(), formatparameters);
+ }
+ catch (FormatException)
+ {
+ message = messagefunc();
+ Logger.WriteError(string.Format("LoggerWrapper.Log(): Incorrectly formatted string: message: '{0}'; formatparameters: {1}", message, string.Join(";", formatparameters)));
+ }
+ }
+ }
+
+ if (exception != null)
+ {
+ // Append the exception to the end of the message.
+ message = string.IsNullOrEmpty(message) ? exception.ToString() : string.Format("{0}\n{1}", message, exception);
+ }
+
+ if (!string.IsNullOrEmpty(message))
+ {
+ switch (loglevel)
+ {
+ case LogLevel.Trace:
+ case LogLevel.Debug:
+ Logger.WriteDebug(message);
+ break;
+ case LogLevel.Info:
+ Logger.WriteInfo(message);
+ break;
+ case LogLevel.Warn:
+ Logger.WriteWarning(message);
+ break;
+ case LogLevel.Error:
+ case LogLevel.Fatal:
+ Logger.WriteError(message);
+ break;
+ }
+ }
+
+ return true;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/GitVersionCore/OutputVariables/VariableProvider.cs b/src/GitVersionCore/OutputVariables/VariableProvider.cs
index c1613c6ca5..ec71af58ed 100644
--- a/src/GitVersionCore/OutputVariables/VariableProvider.cs
+++ b/src/GitVersionCore/OutputVariables/VariableProvider.cs
@@ -76,6 +76,7 @@ public static VersionVariables GetVariablesFor(SemanticVersion semanticVersion,
semverFormatValues.LegacySemVerPadded,
semverFormatValues.FullSemVer,
semverFormatValues.AssemblySemVer,
+ semverFormatValues.AssemblyFileSemVer,
semverFormatValues.PreReleaseTag,
semverFormatValues.PreReleaseTagWithDash,
semverFormatValues.PreReleaseLabel,
diff --git a/src/GitVersionCore/OutputVariables/VersionVariables.cs b/src/GitVersionCore/OutputVariables/VersionVariables.cs
index 28719fbf4e..430736187a 100644
--- a/src/GitVersionCore/OutputVariables/VersionVariables.cs
+++ b/src/GitVersionCore/OutputVariables/VersionVariables.cs
@@ -25,6 +25,7 @@ public VersionVariables(string major,
string legacySemVerPadded,
string fullSemVer,
string assemblySemVer,
+ string assemblySemFileVer,
string preReleaseTag,
string preReleaseTagWithDash,
string preReleaseLabel,
@@ -52,6 +53,7 @@ public VersionVariables(string major,
LegacySemVerPadded = legacySemVerPadded;
FullSemVer = fullSemVer;
AssemblySemVer = assemblySemVer;
+ AssemblySemFileVer = assemblySemFileVer;
PreReleaseTag = preReleaseTag;
PreReleaseTagWithDash = preReleaseTagWithDash;
PreReleaseLabel = preReleaseLabel;
@@ -81,6 +83,7 @@ public VersionVariables(string major,
public string LegacySemVer { get; private set; }
public string LegacySemVerPadded { get; private set; }
public string AssemblySemVer { get; private set; }
+ public string AssemblySemFileVer { get; private set; }
public string FullSemVer { get; private set; }
public string InformationalVersion { get; private set; }
public string BranchName { get; private set; }
diff --git a/src/GitVersionCore/SemanticVersionFormatValues.cs b/src/GitVersionCore/SemanticVersionFormatValues.cs
index ec93bc9d86..02707e630d 100644
--- a/src/GitVersionCore/SemanticVersionFormatValues.cs
+++ b/src/GitVersionCore/SemanticVersionFormatValues.cs
@@ -87,6 +87,10 @@ public string AssemblySemVer
{
get { return _semver.GetAssemblyVersion(_config.AssemblyVersioningScheme); }
}
+ public string AssemblyFileSemVer
+ {
+ get { return _semver.GetAssemblyFileVersion(_config.AssemblyFileVersioningScheme); }
+ }
public string FullSemVer
{
diff --git a/src/GitVersionCore/VersionCalculation/BaseVersionCalculator.cs b/src/GitVersionCore/VersionCalculation/BaseVersionCalculator.cs
index 8010c7b431..66d312dfa8 100644
--- a/src/GitVersionCore/VersionCalculation/BaseVersionCalculator.cs
+++ b/src/GitVersionCore/VersionCalculation/BaseVersionCalculator.cs
@@ -51,7 +51,9 @@ public BaseVersion GetBaseVersion(GitVersionContext context)
BaseVersion baseVersionWithOldestSource;
if (matchingVersionsOnceIncremented.Any())
{
- baseVersionWithOldestSource = matchingVersionsOnceIncremented.Aggregate((v1, v2) => v1.Version.BaseVersionSource.Committer.When < v2.Version.BaseVersionSource.Committer.When ? v1 : v2).Version;
+ var oldest = matchingVersionsOnceIncremented.Aggregate((v1, v2) => v1.Version.BaseVersionSource.Committer.When < v2.Version.BaseVersionSource.Committer.When ? v1 : v2);
+ baseVersionWithOldestSource = oldest.Version;
+ maxVersion = oldest;
Logger.WriteInfo(string.Format(
"Found multiple base versions which will produce the same SemVer ({0}), taking oldest source for commit counting ({1})",
maxVersion.IncrementedVersion,
diff --git a/src/GitVersionCore/VersionFilters/ShaVersionFilter.cs b/src/GitVersionCore/VersionFilters/ShaVersionFilter.cs
index 1f33e214c0..afa1ff5330 100644
--- a/src/GitVersionCore/VersionFilters/ShaVersionFilter.cs
+++ b/src/GitVersionCore/VersionFilters/ShaVersionFilter.cs
@@ -24,7 +24,7 @@ public bool Exclude(BaseVersion version, out string reason)
if (version.BaseVersionSource != null &&
shas.Any(sha => version.BaseVersionSource.Sha.StartsWith(sha, StringComparison.OrdinalIgnoreCase)))
{
- reason = "Source was ignored due to commit having been excluded by configuration";
+ reason = $"Sha {version.BaseVersionSource.Sha} was ignored due to commit having been excluded by configuration";
return true;
}
diff --git a/src/GitVersionCore/packages.config b/src/GitVersionCore/packages.config
index f8e756dc92..b0d5403b79 100644
--- a/src/GitVersionCore/packages.config
+++ b/src/GitVersionCore/packages.config
@@ -3,7 +3,7 @@
-
+
diff --git a/src/GitVersionExe.Tests/GitVersionExe.Tests.csproj b/src/GitVersionExe.Tests/GitVersionExe.Tests.csproj
index 811cc7aa58..9cb08be78b 100644
--- a/src/GitVersionExe.Tests/GitVersionExe.Tests.csproj
+++ b/src/GitVersionExe.Tests/GitVersionExe.Tests.csproj
@@ -12,7 +12,7 @@
GitVersionExe.Tests
v4.5
512
- 5
+ 6
@@ -48,39 +48,27 @@
True
- ..\packages\NUnit3TestAdapter.3.4.1\lib\Mono.Cecil.dll
+ ..\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.dll
True
- ..\packages\NUnit3TestAdapter.3.4.1\lib\Mono.Cecil.Mdb.dll
+ ..\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.Mdb.dll
True
- ..\packages\NUnit3TestAdapter.3.4.1\lib\Mono.Cecil.Pdb.dll
+ ..\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.Pdb.dll
True
- ..\packages\NUnit3TestAdapter.3.4.1\lib\Mono.Cecil.Rocks.dll
+ ..\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.Rocks.dll
True
..\packages\NSubstitute.1.10.0.0\lib\net45\NSubstitute.dll
True
-
- ..\packages\NUnit3TestAdapter.3.4.1\lib\nunit.engine.dll
- True
-
-
- ..\packages\NUnit3TestAdapter.3.4.1\lib\nunit.engine.api.dll
- True
-
-
- ..\packages\NUnit.3.4.1\lib\net45\nunit.framework.dll
- True
-
-
- ..\packages\NUnit3TestAdapter.3.4.1\lib\NUnit3.TestAdapter.dll
+
+ ..\packages\NUnit.3.6.0\lib\net45\nunit.framework.dll
True
@@ -128,6 +116,7 @@
+
diff --git a/src/GitVersionExe.Tests/HelpWriterTests.cs b/src/GitVersionExe.Tests/HelpWriterTests.cs
index eb5a5ef6bc..1b48500636 100644
--- a/src/GitVersionExe.Tests/HelpWriterTests.cs
+++ b/src/GitVersionExe.Tests/HelpWriterTests.cs
@@ -16,7 +16,8 @@ public void AllArgsAreInHelp()
{ "TargetBranch", "/b" },
{ "LogFilePath" , "/l" },
{ "DynamicRepositoryLocation" , "/dynamicRepoLocation" },
- { "IsHelp", "/?" }
+ { "IsHelp", "/?" },
+ { "IsVersion", "/version" }
};
string helpText = null;
diff --git a/src/GitVersionExe.Tests/VersionWriterTests.cs b/src/GitVersionExe.Tests/VersionWriterTests.cs
new file mode 100644
index 0000000000..91acf3bfce
--- /dev/null
+++ b/src/GitVersionExe.Tests/VersionWriterTests.cs
@@ -0,0 +1,56 @@
+namespace GitVersionExe.Tests
+{
+ using System;
+ using System.IO;
+ using System.Reflection;
+ using GitVersion;
+ using Mono.Cecil;
+ using NUnit.Framework;
+
+ [TestFixture]
+ public class VersionWriterTests
+ {
+ [Test]
+ public void WriteVersion_ShouldWriteFileVersion_WithNoPrereleaseTag()
+ {
+ var asm = GenerateAssembly(new Version(1, 0, 0), "");
+
+ string version = null;
+ VersionWriter.WriteTo(asm, v => version = v);
+
+ Assert.IsNotNull(asm);
+ Assert.AreEqual("1.0.0", version);
+ }
+
+ [Test]
+ public void WriteVersion_ShouldWriteFileVersion_WithPrereleaseTag()
+ {
+ var asm = GenerateAssembly(new Version(1, 0, 0), "-beta0004");
+
+ string version = null;
+ VersionWriter.WriteTo(asm, v => version = v);
+
+ Assert.IsNotNull(asm);
+ Assert.AreEqual("1.0.0-beta0004", version);
+ }
+
+ private Assembly GenerateAssembly(Version fileVersion, string prereleaseInfo)
+ {
+ var definition = new AssemblyNameDefinition("test-asm", fileVersion);
+
+ var asmDef = AssemblyDefinition.CreateAssembly(definition, "test-asm", ModuleKind.Dll);
+ var constructor = typeof(AssemblyInformationalVersionAttribute).GetConstructor(new[] { typeof(string) });
+ var methodReference = asmDef.MainModule.Import(constructor);
+ var customAttribute = new CustomAttribute(methodReference);
+ customAttribute.ConstructorArguments.Add(new CustomAttributeArgument(asmDef.MainModule.TypeSystem.String, fileVersion + prereleaseInfo));
+ asmDef.CustomAttributes.Add(customAttribute);
+
+ using (var memoryStream = new MemoryStream())
+ {
+ asmDef.Write(memoryStream);
+
+ return Assembly.Load(memoryStream.ToArray());
+ }
+ }
+ }
+}
diff --git a/src/GitVersionExe.Tests/packages.config b/src/GitVersionExe.Tests/packages.config
index 11caeec12f..30641d4d15 100644
--- a/src/GitVersionExe.Tests/packages.config
+++ b/src/GitVersionExe.Tests/packages.config
@@ -4,8 +4,9 @@
+
-
-
+
+
\ No newline at end of file
diff --git a/src/GitVersionExe/ArgumentParser.cs b/src/GitVersionExe/ArgumentParser.cs
index 43962002a8..3323686a3c 100644
--- a/src/GitVersionExe/ArgumentParser.cs
+++ b/src/GitVersionExe/ArgumentParser.cs
@@ -65,6 +65,13 @@ public static Arguments ParseArguments(List commandLineArguments)
var values = switchesAndValues.GetValues(name);
var value = values != null ? values.FirstOrDefault() : null;
+ if (name.IsSwitch("version"))
+ {
+ EnsureArgumentValueCount(values);
+ arguments.IsVersion = true;
+ continue;
+ }
+
if (name.IsSwitch("l"))
{
EnsureArgumentValueCount(values);
diff --git a/src/GitVersionExe/Arguments.cs b/src/GitVersionExe/Arguments.cs
index 5261845932..910ee131e2 100644
--- a/src/GitVersionExe/Arguments.cs
+++ b/src/GitVersionExe/Arguments.cs
@@ -28,6 +28,7 @@ public Arguments()
public bool Init;
public bool Diag;
+ public bool IsVersion;
public bool IsHelp;
public string LogFilePath;
public string ShowVariable;
diff --git a/src/GitVersionExe/AssemblyInfoFileUpdate.cs b/src/GitVersionExe/AssemblyInfoFileUpdate.cs
index d9d294193f..385b768fcc 100644
--- a/src/GitVersionExe/AssemblyInfoFileUpdate.cs
+++ b/src/GitVersionExe/AssemblyInfoFileUpdate.cs
@@ -22,17 +22,17 @@ public AssemblyInfoFileUpdate(Arguments args, string workingDirectory, VersionVa
Logger.WriteInfo("Updating assembly info files");
var assemblyInfoFiles = GetAssemblyInfoFiles(workingDirectory, args, fileSystem).ToList();
- Logger.WriteInfo(string.Format("Found {0} files", assemblyInfoFiles.Count));
+ Logger.WriteInfo($"Found {assemblyInfoFiles.Count} files");
var assemblyVersion = variables.AssemblySemVer;
var assemblyVersionRegex = new Regex(@"AssemblyVersion(Attribute)?\s*\(\s*""[^""]*""\s*\)");
- var assemblyVersionString = !string.IsNullOrWhiteSpace(assemblyVersion) ? string.Format("AssemblyVersion(\"{0}\")", assemblyVersion) : null;
+ var assemblyVersionString = !string.IsNullOrWhiteSpace(assemblyVersion) ? $"AssemblyVersion(\"{assemblyVersion}\")" : null;
var assemblyInfoVersion = variables.InformationalVersion;
var assemblyInfoVersionRegex = new Regex(@"AssemblyInformationalVersion(Attribute)?\s*\(\s*""[^""]*""\s*\)");
- var assemblyInfoVersionString = string.Format("AssemblyInformationalVersion(\"{0}\")", assemblyInfoVersion);
- var assemblyFileVersion = variables.MajorMinorPatch + ".0";
- var assemblyFileVersionRegex = new Regex(@"AssemblyFileVersion(Attribute)?\s*\(\s*""[^""]*""\s*\)");
- var assemblyFileVersionString = string.Format("AssemblyFileVersion(\"{0}\")", assemblyFileVersion);
+ var assemblyInfoVersionString = $"AssemblyInformationalVersion(\"{assemblyInfoVersion}\")";
+ var assemblyFileVersion = variables.AssemblySemFileVer;
+ var assemblyFileVersionRegex = new Regex(@"AssemblyFileVersion(Attribute)?\s*\(\s*""[^""]*""\s*\)");
+ var assemblyFileVersionString = !string.IsNullOrWhiteSpace(assemblyFileVersion) ? $"AssemblyFileVersion(\"{assemblyFileVersion}\")" : null;
foreach (var assemblyInfoFile in assemblyInfoFiles)
{
@@ -47,21 +47,28 @@ public AssemblyInfoFileUpdate(Arguments args, string workingDirectory, VersionVa
});
cleanupBackupTasks.Add(() => fileSystem.Delete(backupAssemblyInfo));
- var fileContents = fileSystem.ReadAllText(assemblyInfoFile.FullName);
+ var originalFileContents = fileSystem.ReadAllText(assemblyInfoFile.FullName);
+ var fileContents = originalFileContents;
var appendedAttributes = false;
if (!string.IsNullOrWhiteSpace(assemblyVersion))
{
fileContents = ReplaceOrAppend(assemblyVersionRegex, fileContents, assemblyVersionString, assemblyInfoFile.Extension, ref appendedAttributes);
}
+ if (!string.IsNullOrWhiteSpace(assemblyFileVersion))
+ {
+ fileContents = ReplaceOrAppend(assemblyFileVersionRegex, fileContents, assemblyFileVersionString, assemblyInfoFile.Extension, ref appendedAttributes);
+ }
fileContents = ReplaceOrAppend(assemblyInfoVersionRegex, fileContents, assemblyInfoVersionString, assemblyInfoFile.Extension, ref appendedAttributes);
- fileContents = ReplaceOrAppend(assemblyFileVersionRegex, fileContents, assemblyFileVersionString, assemblyInfoFile.Extension, ref appendedAttributes);
if (appendedAttributes)
{
// If we appended any attributes, put a new line after them
fileContents += Environment.NewLine;
}
- fileSystem.WriteAllText(assemblyInfoFile.FullName, fileContents);
+ if (originalFileContents != fileContents)
+ {
+ fileSystem.WriteAllText(assemblyInfoFile.FullName, fileContents);
+ }
}
}
@@ -126,7 +133,7 @@ static bool EnsureVersionAssemblyInfoFile(Arguments arguments, IFileSystem fileS
fileSystem.WriteAllText(fullPath, assemblyInfoSource);
return true;
}
- Logger.WriteWarning(string.Format("No version assembly info template available to create source file '{0}'", arguments.UpdateAssemblyInfoFileName));
+ Logger.WriteWarning($"No version assembly info template available to create source file '{arguments.UpdateAssemblyInfoFileName}'");
return false;
}
diff --git a/src/GitVersionExe/GitVersionExe.csproj b/src/GitVersionExe/GitVersionExe.csproj
index a4e29c3d44..421640a94b 100644
--- a/src/GitVersionExe/GitVersionExe.csproj
+++ b/src/GitVersionExe/GitVersionExe.csproj
@@ -11,7 +11,7 @@
GitVersion
GitVersion
v4.0
- 5
+ 6
512
$(SolutionDir)..\build\
@@ -45,8 +45,8 @@
..\packages\GitTools.Core.1.2.1-beta0001\lib\net4\GitTools.Core.dll
True
-
- ..\packages\JetBrainsAnnotations.Fody.1.0.4.0\Lib\JetBrains.Annotations.dll
+
+ ..\packages\JetBrainsAnnotations.Fody.1.0.5.0\Lib\JetBrains.Annotations.dll
False
@@ -72,6 +72,7 @@
+
@@ -150,7 +151,7 @@
-
+
@@ -161,7 +162,7 @@
-
+
diff --git a/src/GitVersionExe/HelpWriter.cs b/src/GitVersionExe/HelpWriter.cs
index a2ed886dbd..6dc97a5de9 100644
--- a/src/GitVersionExe/HelpWriter.cs
+++ b/src/GitVersionExe/HelpWriter.cs
@@ -1,6 +1,7 @@
namespace GitVersion
{
using System;
+ using System.Reflection;
class HelpWriter
{
@@ -11,12 +12,18 @@ public static void Write()
public static void WriteTo(Action writeAction)
{
- const string message = @"Use convention to derive a SemVer product version from a GitFlow or GitHub based repository.
+ string version = string.Empty;
+ Assembly assembly = Assembly.GetExecutingAssembly();
+ VersionWriter.WriteTo(assembly, v => version = v);
+
+ string message = "GitVersion " + version + @"
+Use convention to derive a SemVer product version from a GitFlow or GitHub based repository.
GitVersion [path]
path The directory containing .git. If not defined current directory is used. (Must be first argument)
init Configuration utility for gitversion
+ /version Displays the version of GitVersion
/diag Runs GitVersion with additional diagnostic information (requires git.exe to be installed)
/h or /? Shows Help
diff --git a/src/GitVersionExe/Program.cs b/src/GitVersionExe/Program.cs
index 610624cc5e..efa7db3beb 100644
--- a/src/GitVersionExe/Program.cs
+++ b/src/GitVersionExe/Program.cs
@@ -7,6 +7,7 @@ namespace GitVersion
using System.Diagnostics;
using System.IO;
using System.Linq;
+ using System.Reflection;
using System.Text;
class Program
@@ -57,6 +58,13 @@ static int VerifyArgumentsAndRun()
return 1;
}
+ if (arguments.IsVersion)
+ {
+ var assembly = Assembly.GetExecutingAssembly();
+ VersionWriter.Write(assembly);
+ return 0;
+ }
+
if (arguments.IsHelp)
{
HelpWriter.Write();
diff --git a/src/GitVersionExe/VersionWriter.cs b/src/GitVersionExe/VersionWriter.cs
new file mode 100644
index 0000000000..0302ade726
--- /dev/null
+++ b/src/GitVersionExe/VersionWriter.cs
@@ -0,0 +1,34 @@
+namespace GitVersion
+{
+ using System;
+ using System.Linq;
+ using System.Reflection;
+
+ class VersionWriter
+ {
+ public static void Write(Assembly assembly)
+ {
+ WriteTo(assembly, Console.WriteLine);
+ }
+
+ public static void WriteTo(Assembly assembly, Action writeAction)
+ {
+ var version = GetAssemblyVersion(assembly);
+ writeAction(version);
+ }
+
+ private static string GetAssemblyVersion(Assembly assembly)
+ {
+ var attribute = assembly
+ .GetCustomAttributes(typeof(AssemblyInformationalVersionAttribute), false)
+ .FirstOrDefault() as AssemblyInformationalVersionAttribute;
+
+ if (attribute != null)
+ {
+ return attribute.InformationalVersion;
+ }
+
+ return assembly.GetName().Version.ToString();
+ }
+ }
+}
diff --git a/src/GitVersionExe/packages.config b/src/GitVersionExe/packages.config
index f2449c8ed2..8712c8ce09 100644
--- a/src/GitVersionExe/packages.config
+++ b/src/GitVersionExe/packages.config
@@ -3,8 +3,8 @@
-
-
+
+
diff --git a/src/GitVersionTask.Tests/Approved/CSharp/AssemblyInfoBuilderTests.VerifyAssemblyVersion_Major.approved.txt b/src/GitVersionTask.Tests/Approved/CSharp/AssemblyInfoBuilderTests.VerifyAssemblyVersion_Major.approved.txt
index 0e997ea146..5ee1497a23 100644
--- a/src/GitVersionTask.Tests/Approved/CSharp/AssemblyInfoBuilderTests.VerifyAssemblyVersion_Major.approved.txt
+++ b/src/GitVersionTask.Tests/Approved/CSharp/AssemblyInfoBuilderTests.VerifyAssemblyVersion_Major.approved.txt
@@ -1,4 +1,4 @@
-//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
//
// This code was generated by a tool.
// GitVersion
@@ -36,6 +36,7 @@ namespace Fake
public static string LegacySemVer = "2.3.4-beta5";
public static string LegacySemVerPadded = "2.3.4-beta0005";
public static string AssemblySemVer = "2.0.0.0";
+ public static string AssemblySemFileVer = "2.3.4.0";
public static string FullSemVer = "2.3.4-beta.5+6";
public static string InformationalVersion = "2.3.4-beta.5+6.Branch.master.Sha.commitSha";
public static string BranchName = "master";
diff --git a/src/GitVersionTask.Tests/Approved/CSharp/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinor.approved.txt b/src/GitVersionTask.Tests/Approved/CSharp/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinor.approved.txt
index d85691e47e..9b1da35f6d 100644
--- a/src/GitVersionTask.Tests/Approved/CSharp/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinor.approved.txt
+++ b/src/GitVersionTask.Tests/Approved/CSharp/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinor.approved.txt
@@ -1,4 +1,4 @@
-//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
//
// This code was generated by a tool.
// GitVersion
@@ -36,6 +36,7 @@ namespace Fake
public static string LegacySemVer = "2.3.4-beta5";
public static string LegacySemVerPadded = "2.3.4-beta0005";
public static string AssemblySemVer = "2.3.0.0";
+ public static string AssemblySemFileVer = "2.3.4.0";
public static string FullSemVer = "2.3.4-beta.5+6";
public static string InformationalVersion = "2.3.4-beta.5+6.Branch.master.Sha.commitSha";
public static string BranchName = "master";
diff --git a/src/GitVersionTask.Tests/Approved/CSharp/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinorPatch.approved.txt b/src/GitVersionTask.Tests/Approved/CSharp/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinorPatch.approved.txt
index 1170939dfa..6958d82972 100644
--- a/src/GitVersionTask.Tests/Approved/CSharp/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinorPatch.approved.txt
+++ b/src/GitVersionTask.Tests/Approved/CSharp/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinorPatch.approved.txt
@@ -1,4 +1,4 @@
-//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
//
// This code was generated by a tool.
// GitVersion
@@ -36,6 +36,7 @@ namespace Fake
public static string LegacySemVer = "2.3.4-beta5";
public static string LegacySemVerPadded = "2.3.4-beta0005";
public static string AssemblySemVer = "2.3.4.0";
+ public static string AssemblySemFileVer = "2.3.4.0";
public static string FullSemVer = "2.3.4-beta.5+6";
public static string InformationalVersion = "2.3.4-beta.5+6.Branch.master.Sha.commitSha";
public static string BranchName = "master";
diff --git a/src/GitVersionTask.Tests/Approved/CSharp/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinorPatchTag.approved.txt b/src/GitVersionTask.Tests/Approved/CSharp/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinorPatchTag.approved.txt
index 0aca25785e..58a3423c5d 100644
--- a/src/GitVersionTask.Tests/Approved/CSharp/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinorPatchTag.approved.txt
+++ b/src/GitVersionTask.Tests/Approved/CSharp/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinorPatchTag.approved.txt
@@ -1,4 +1,4 @@
-//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
//
// This code was generated by a tool.
// GitVersion
@@ -36,6 +36,7 @@ namespace Fake
public static string LegacySemVer = "2.3.4-beta5";
public static string LegacySemVerPadded = "2.3.4-beta0005";
public static string AssemblySemVer = "2.3.4.5";
+ public static string AssemblySemFileVer = "2.3.4.0";
public static string FullSemVer = "2.3.4-beta.5+6";
public static string InformationalVersion = "2.3.4-beta.5+6.Branch.master.Sha.commitSha";
public static string BranchName = "master";
diff --git a/src/GitVersionTask.Tests/Approved/CSharp/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinorPatchTag_NugetAssemblyInfo.approved.txt b/src/GitVersionTask.Tests/Approved/CSharp/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinorPatchTag_NugetAssemblyInfo.approved.txt
index 4d7c513035..06fb222279 100644
--- a/src/GitVersionTask.Tests/Approved/CSharp/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinorPatchTag_NugetAssemblyInfo.approved.txt
+++ b/src/GitVersionTask.Tests/Approved/CSharp/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinorPatchTag_NugetAssemblyInfo.approved.txt
@@ -1,4 +1,4 @@
-//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
//
// This code was generated by a tool.
// GitVersion
@@ -36,6 +36,7 @@ namespace Fake
public static string LegacySemVer = "2.3.4-beta5";
public static string LegacySemVerPadded = "2.3.4-beta0005";
public static string AssemblySemVer = "2.3.4.5";
+ public static string AssemblySemFileVer = "2.3.4.0";
public static string FullSemVer = "2.3.4-beta.5+6";
public static string InformationalVersion = "2.3.4-beta0005";
public static string BranchName = "master";
diff --git a/src/GitVersionTask.Tests/Approved/CSharp/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinorPatch_NugetAssemblyInfo.approved.txt b/src/GitVersionTask.Tests/Approved/CSharp/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinorPatch_NugetAssemblyInfo.approved.txt
index 3422554882..db88ab0cbb 100644
--- a/src/GitVersionTask.Tests/Approved/CSharp/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinorPatch_NugetAssemblyInfo.approved.txt
+++ b/src/GitVersionTask.Tests/Approved/CSharp/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinorPatch_NugetAssemblyInfo.approved.txt
@@ -1,4 +1,4 @@
-//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
//
// This code was generated by a tool.
// GitVersion
@@ -36,6 +36,7 @@ namespace Fake
public static string LegacySemVer = "2.3.4-beta5";
public static string LegacySemVerPadded = "2.3.4-beta0005";
public static string AssemblySemVer = "2.3.4.0";
+ public static string AssemblySemFileVer = "2.3.4.0";
public static string FullSemVer = "2.3.4-beta.5+6";
public static string InformationalVersion = "2.3.4-beta0005";
public static string BranchName = "master";
diff --git a/src/GitVersionTask.Tests/Approved/CSharp/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinor_NugetAssemblyInfo.approved.txt b/src/GitVersionTask.Tests/Approved/CSharp/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinor_NugetAssemblyInfo.approved.txt
index 97b0345900..c33258c7cd 100644
--- a/src/GitVersionTask.Tests/Approved/CSharp/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinor_NugetAssemblyInfo.approved.txt
+++ b/src/GitVersionTask.Tests/Approved/CSharp/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinor_NugetAssemblyInfo.approved.txt
@@ -1,4 +1,4 @@
-//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
//
// This code was generated by a tool.
// GitVersion
@@ -36,6 +36,7 @@ namespace Fake
public static string LegacySemVer = "2.3.4-beta5";
public static string LegacySemVerPadded = "2.3.4-beta0005";
public static string AssemblySemVer = "2.3.0.0";
+ public static string AssemblySemFileVer = "2.3.4.0";
public static string FullSemVer = "2.3.4-beta.5+6";
public static string InformationalVersion = "2.3.4-beta0005";
public static string BranchName = "master";
diff --git a/src/GitVersionTask.Tests/Approved/CSharp/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinor_NugetAssemblyInfoWithMultipleVariables.approved.txt b/src/GitVersionTask.Tests/Approved/CSharp/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinor_NugetAssemblyInfoWithMultipleVariables.approved.txt
index 5054741b4b..631ffa483f 100644
--- a/src/GitVersionTask.Tests/Approved/CSharp/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinor_NugetAssemblyInfoWithMultipleVariables.approved.txt
+++ b/src/GitVersionTask.Tests/Approved/CSharp/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinor_NugetAssemblyInfoWithMultipleVariables.approved.txt
@@ -1,4 +1,4 @@
-//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
//
// This code was generated by a tool.
// GitVersion
@@ -36,6 +36,7 @@ namespace Fake
public static string LegacySemVer = "2.3.4-beta5";
public static string LegacySemVerPadded = "2.3.4-beta0005";
public static string AssemblySemVer = "2.3.0.0";
+ public static string AssemblySemFileVer = "2.3.4.0";
public static string FullSemVer = "2.3.4-beta.5+6";
public static string InformationalVersion = "master-2.3.4-commitSha";
public static string BranchName = "master";
diff --git a/src/GitVersionTask.Tests/Approved/CSharp/AssemblyInfoBuilderTests.VerifyAssemblyVersion_Major_NugetAssemblyInfo.approved.txt b/src/GitVersionTask.Tests/Approved/CSharp/AssemblyInfoBuilderTests.VerifyAssemblyVersion_Major_NugetAssemblyInfo.approved.txt
index bcff3d091a..95f0f5567d 100644
--- a/src/GitVersionTask.Tests/Approved/CSharp/AssemblyInfoBuilderTests.VerifyAssemblyVersion_Major_NugetAssemblyInfo.approved.txt
+++ b/src/GitVersionTask.Tests/Approved/CSharp/AssemblyInfoBuilderTests.VerifyAssemblyVersion_Major_NugetAssemblyInfo.approved.txt
@@ -1,4 +1,4 @@
-//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
//
// This code was generated by a tool.
// GitVersion
@@ -36,6 +36,7 @@ namespace Fake
public static string LegacySemVer = "2.3.4-beta5";
public static string LegacySemVerPadded = "2.3.4-beta0005";
public static string AssemblySemVer = "2.0.0.0";
+ public static string AssemblySemFileVer = "2.3.4.0";
public static string FullSemVer = "2.3.4-beta.5+6";
public static string InformationalVersion = "2.3.4-beta0005";
public static string BranchName = "master";
diff --git a/src/GitVersionTask.Tests/Approved/CSharp/AssemblyInfoBuilderTests.VerifyCreatedCode.approved.txt b/src/GitVersionTask.Tests/Approved/CSharp/AssemblyInfoBuilderTests.VerifyCreatedCode.approved.txt
index 1aa46340a5..b41f45e9d4 100644
--- a/src/GitVersionTask.Tests/Approved/CSharp/AssemblyInfoBuilderTests.VerifyCreatedCode.approved.txt
+++ b/src/GitVersionTask.Tests/Approved/CSharp/AssemblyInfoBuilderTests.VerifyCreatedCode.approved.txt
@@ -1,4 +1,4 @@
-//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
//
// This code was generated by a tool.
// GitVersion
@@ -36,6 +36,7 @@ namespace Fake
public static string LegacySemVer = "1.2.3-unstable4";
public static string LegacySemVerPadded = "1.2.3-unstable0004";
public static string AssemblySemVer = "1.2.3.0";
+ public static string AssemblySemFileVer = "1.2.3.0";
public static string FullSemVer = "1.2.3-unstable.4+5";
public static string InformationalVersion = "1.2.3-unstable.4+5.Branch.feature1.Sha.commitSha";
public static string BranchName = "feature1";
diff --git a/src/GitVersionTask.Tests/Approved/CSharp/AssemblyInfoBuilderTests.VerifyCreatedCode_NoNamespaceConflict.approved.txt b/src/GitVersionTask.Tests/Approved/CSharp/AssemblyInfoBuilderTests.VerifyCreatedCode_NoNamespaceConflict.approved.txt
index d42893d62e..57896a8c89 100644
--- a/src/GitVersionTask.Tests/Approved/CSharp/AssemblyInfoBuilderTests.VerifyCreatedCode_NoNamespaceConflict.approved.txt
+++ b/src/GitVersionTask.Tests/Approved/CSharp/AssemblyInfoBuilderTests.VerifyCreatedCode_NoNamespaceConflict.approved.txt
@@ -1,4 +1,4 @@
-//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
//
// This code was generated by a tool.
// GitVersion
@@ -36,6 +36,7 @@ namespace Fake.System
public static string LegacySemVer = "1.2.3-unstable4";
public static string LegacySemVerPadded = "1.2.3-unstable0004";
public static string AssemblySemVer = "1.2.3.0";
+ public static string AssemblySemFileVer = "1.2.3.0";
public static string FullSemVer = "1.2.3-unstable.4+5";
public static string InformationalVersion = "1.2.3-unstable.4+5.Branch.feature1.Sha.commitSha";
public static string BranchName = "feature1";
diff --git a/src/GitVersionTask.Tests/Approved/VisualBasic/AssemblyInfoBuilderTests.VerifyAssemblyVersion_Major.approved.txt b/src/GitVersionTask.Tests/Approved/VisualBasic/AssemblyInfoBuilderTests.VerifyAssemblyVersion_Major.approved.txt
index c2f26580b9..af764ff027 100644
--- a/src/GitVersionTask.Tests/Approved/VisualBasic/AssemblyInfoBuilderTests.VerifyAssemblyVersion_Major.approved.txt
+++ b/src/GitVersionTask.Tests/Approved/VisualBasic/AssemblyInfoBuilderTests.VerifyAssemblyVersion_Major.approved.txt
@@ -34,6 +34,7 @@ NotInheritable Class GitVersionInformation
Public Shared LegacySemVer As String = "2.3.4-beta5"
Public Shared LegacySemVerPadded As String = "2.3.4-beta0005"
Public Shared AssemblySemVer As String = "2.0.0.0"
+ Public Shared AssemblySemFileVer As String = "2.3.4.0"
Public Shared FullSemVer As String = "2.3.4-beta.5+6"
Public Shared InformationalVersion As String = "2.3.4-beta.5+6.Branch.master.Sha.commitSha"
Public Shared BranchName As String = "master"
diff --git a/src/GitVersionTask.Tests/Approved/VisualBasic/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinor.approved.txt b/src/GitVersionTask.Tests/Approved/VisualBasic/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinor.approved.txt
index 815846a967..c9a5a3f14e 100644
--- a/src/GitVersionTask.Tests/Approved/VisualBasic/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinor.approved.txt
+++ b/src/GitVersionTask.Tests/Approved/VisualBasic/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinor.approved.txt
@@ -34,6 +34,7 @@ NotInheritable Class GitVersionInformation
Public Shared LegacySemVer As String = "2.3.4-beta5"
Public Shared LegacySemVerPadded As String = "2.3.4-beta0005"
Public Shared AssemblySemVer As String = "2.3.0.0"
+ Public Shared AssemblySemFileVer As String = "2.3.4.0"
Public Shared FullSemVer As String = "2.3.4-beta.5+6"
Public Shared InformationalVersion As String = "2.3.4-beta.5+6.Branch.master.Sha.commitSha"
Public Shared BranchName As String = "master"
diff --git a/src/GitVersionTask.Tests/Approved/VisualBasic/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinorPatch.approved.txt b/src/GitVersionTask.Tests/Approved/VisualBasic/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinorPatch.approved.txt
index 21f242cb88..b73093cc3b 100644
--- a/src/GitVersionTask.Tests/Approved/VisualBasic/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinorPatch.approved.txt
+++ b/src/GitVersionTask.Tests/Approved/VisualBasic/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinorPatch.approved.txt
@@ -34,6 +34,7 @@ NotInheritable Class GitVersionInformation
Public Shared LegacySemVer As String = "2.3.4-beta5"
Public Shared LegacySemVerPadded As String = "2.3.4-beta0005"
Public Shared AssemblySemVer As String = "2.3.4.0"
+ Public Shared AssemblySemFileVer As String = "2.3.4.0"
Public Shared FullSemVer As String = "2.3.4-beta.5+6"
Public Shared InformationalVersion As String = "2.3.4-beta.5+6.Branch.master.Sha.commitSha"
Public Shared BranchName As String = "master"
diff --git a/src/GitVersionTask.Tests/Approved/VisualBasic/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinorPatchTag.approved.txt b/src/GitVersionTask.Tests/Approved/VisualBasic/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinorPatchTag.approved.txt
index 6cb1a801bc..4611402968 100644
--- a/src/GitVersionTask.Tests/Approved/VisualBasic/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinorPatchTag.approved.txt
+++ b/src/GitVersionTask.Tests/Approved/VisualBasic/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinorPatchTag.approved.txt
@@ -34,6 +34,7 @@ NotInheritable Class GitVersionInformation
Public Shared LegacySemVer As String = "2.3.4-beta5"
Public Shared LegacySemVerPadded As String = "2.3.4-beta0005"
Public Shared AssemblySemVer As String = "2.3.4.5"
+ Public Shared AssemblySemFileVer As String = "2.3.4.0"
Public Shared FullSemVer As String = "2.3.4-beta.5+6"
Public Shared InformationalVersion As String = "2.3.4-beta.5+6.Branch.master.Sha.commitSha"
Public Shared BranchName As String = "master"
diff --git a/src/GitVersionTask.Tests/Approved/VisualBasic/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinorPatchTag_NugetAssemblyInfo.approved.txt b/src/GitVersionTask.Tests/Approved/VisualBasic/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinorPatchTag_NugetAssemblyInfo.approved.txt
index 7954721264..8835f12462 100644
--- a/src/GitVersionTask.Tests/Approved/VisualBasic/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinorPatchTag_NugetAssemblyInfo.approved.txt
+++ b/src/GitVersionTask.Tests/Approved/VisualBasic/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinorPatchTag_NugetAssemblyInfo.approved.txt
@@ -34,6 +34,7 @@ NotInheritable Class GitVersionInformation
Public Shared LegacySemVer As String = "2.3.4-beta5"
Public Shared LegacySemVerPadded As String = "2.3.4-beta0005"
Public Shared AssemblySemVer As String = "2.3.4.5"
+ Public Shared AssemblySemFileVer As String = "2.3.4.0"
Public Shared FullSemVer As String = "2.3.4-beta.5+6"
Public Shared InformationalVersion As String = "2.3.4-beta0005"
Public Shared BranchName As String = "master"
diff --git a/src/GitVersionTask.Tests/Approved/VisualBasic/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinorPatch_NugetAssemblyInfo.approved.txt b/src/GitVersionTask.Tests/Approved/VisualBasic/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinorPatch_NugetAssemblyInfo.approved.txt
index d04809c150..5830062927 100644
--- a/src/GitVersionTask.Tests/Approved/VisualBasic/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinorPatch_NugetAssemblyInfo.approved.txt
+++ b/src/GitVersionTask.Tests/Approved/VisualBasic/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinorPatch_NugetAssemblyInfo.approved.txt
@@ -34,6 +34,7 @@ NotInheritable Class GitVersionInformation
Public Shared LegacySemVer As String = "2.3.4-beta5"
Public Shared LegacySemVerPadded As String = "2.3.4-beta0005"
Public Shared AssemblySemVer As String = "2.3.4.0"
+ Public Shared AssemblySemFileVer As String = "2.3.4.0"
Public Shared FullSemVer As String = "2.3.4-beta.5+6"
Public Shared InformationalVersion As String = "2.3.4-beta0005"
Public Shared BranchName As String = "master"
diff --git a/src/GitVersionTask.Tests/Approved/VisualBasic/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinor_NugetAssemblyInfo.approved.txt b/src/GitVersionTask.Tests/Approved/VisualBasic/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinor_NugetAssemblyInfo.approved.txt
index 41649c3346..6427bb3e62 100644
--- a/src/GitVersionTask.Tests/Approved/VisualBasic/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinor_NugetAssemblyInfo.approved.txt
+++ b/src/GitVersionTask.Tests/Approved/VisualBasic/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinor_NugetAssemblyInfo.approved.txt
@@ -34,6 +34,7 @@ NotInheritable Class GitVersionInformation
Public Shared LegacySemVer As String = "2.3.4-beta5"
Public Shared LegacySemVerPadded As String = "2.3.4-beta0005"
Public Shared AssemblySemVer As String = "2.3.0.0"
+ Public Shared AssemblySemFileVer As String = "2.3.4.0"
Public Shared FullSemVer As String = "2.3.4-beta.5+6"
Public Shared InformationalVersion As String = "2.3.4-beta0005"
Public Shared BranchName As String = "master"
diff --git a/src/GitVersionTask.Tests/Approved/VisualBasic/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinor_NugetAssemblyInfoWithMultipleVariables.approved.txt b/src/GitVersionTask.Tests/Approved/VisualBasic/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinor_NugetAssemblyInfoWithMultipleVariables.approved.txt
index f43d0c1f00..e01886df17 100644
--- a/src/GitVersionTask.Tests/Approved/VisualBasic/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinor_NugetAssemblyInfoWithMultipleVariables.approved.txt
+++ b/src/GitVersionTask.Tests/Approved/VisualBasic/AssemblyInfoBuilderTests.VerifyAssemblyVersion_MajorMinor_NugetAssemblyInfoWithMultipleVariables.approved.txt
@@ -34,6 +34,7 @@ NotInheritable Class GitVersionInformation
Public Shared LegacySemVer As String = "2.3.4-beta5"
Public Shared LegacySemVerPadded As String = "2.3.4-beta0005"
Public Shared AssemblySemVer As String = "2.3.0.0"
+ Public Shared AssemblySemFileVer As String = "2.3.4.0"
Public Shared FullSemVer As String = "2.3.4-beta.5+6"
Public Shared InformationalVersion As String = "master-2.3.4-commitSha"
Public Shared BranchName As String = "master"
diff --git a/src/GitVersionTask.Tests/Approved/VisualBasic/AssemblyInfoBuilderTests.VerifyAssemblyVersion_Major_NugetAssemblyInfo.approved.txt b/src/GitVersionTask.Tests/Approved/VisualBasic/AssemblyInfoBuilderTests.VerifyAssemblyVersion_Major_NugetAssemblyInfo.approved.txt
index 8479e8a3a1..5e45b4e67a 100644
--- a/src/GitVersionTask.Tests/Approved/VisualBasic/AssemblyInfoBuilderTests.VerifyAssemblyVersion_Major_NugetAssemblyInfo.approved.txt
+++ b/src/GitVersionTask.Tests/Approved/VisualBasic/AssemblyInfoBuilderTests.VerifyAssemblyVersion_Major_NugetAssemblyInfo.approved.txt
@@ -34,6 +34,7 @@ NotInheritable Class GitVersionInformation
Public Shared LegacySemVer As String = "2.3.4-beta5"
Public Shared LegacySemVerPadded As String = "2.3.4-beta0005"
Public Shared AssemblySemVer As String = "2.0.0.0"
+ Public Shared AssemblySemFileVer As String = "2.3.4.0"
Public Shared FullSemVer As String = "2.3.4-beta.5+6"
Public Shared InformationalVersion As String = "2.3.4-beta0005"
Public Shared BranchName As String = "master"
diff --git a/src/GitVersionTask.Tests/Approved/VisualBasic/AssemblyInfoBuilderTests.VerifyCreatedCode.approved.txt b/src/GitVersionTask.Tests/Approved/VisualBasic/AssemblyInfoBuilderTests.VerifyCreatedCode.approved.txt
index 5990b11448..da1571e592 100644
--- a/src/GitVersionTask.Tests/Approved/VisualBasic/AssemblyInfoBuilderTests.VerifyCreatedCode.approved.txt
+++ b/src/GitVersionTask.Tests/Approved/VisualBasic/AssemblyInfoBuilderTests.VerifyCreatedCode.approved.txt
@@ -34,6 +34,7 @@ NotInheritable Class GitVersionInformation
Public Shared LegacySemVer As String = "1.2.3-unstable4"
Public Shared LegacySemVerPadded As String = "1.2.3-unstable0004"
Public Shared AssemblySemVer As String = "1.2.3.0"
+ Public Shared AssemblySemFileVer As String = "1.2.3.0"
Public Shared FullSemVer As String = "1.2.3-unstable.4+5"
Public Shared InformationalVersion As String = "1.2.3-unstable.4+5.Branch.feature1.Sha.commitSha"
Public Shared BranchName As String = "feature1"
diff --git a/src/GitVersionTask.Tests/Approved/VisualBasic/AssemblyInfoBuilderTests.VerifyCreatedCode_NoNamespaceConflict.approved.txt b/src/GitVersionTask.Tests/Approved/VisualBasic/AssemblyInfoBuilderTests.VerifyCreatedCode_NoNamespaceConflict.approved.txt
index 5990b11448..da1571e592 100644
--- a/src/GitVersionTask.Tests/Approved/VisualBasic/AssemblyInfoBuilderTests.VerifyCreatedCode_NoNamespaceConflict.approved.txt
+++ b/src/GitVersionTask.Tests/Approved/VisualBasic/AssemblyInfoBuilderTests.VerifyCreatedCode_NoNamespaceConflict.approved.txt
@@ -34,6 +34,7 @@ NotInheritable Class GitVersionInformation
Public Shared LegacySemVer As String = "1.2.3-unstable4"
Public Shared LegacySemVerPadded As String = "1.2.3-unstable0004"
Public Shared AssemblySemVer As String = "1.2.3.0"
+ Public Shared AssemblySemFileVer As String = "1.2.3.0"
Public Shared FullSemVer As String = "1.2.3-unstable.4+5"
Public Shared InformationalVersion As String = "1.2.3-unstable.4+5.Branch.feature1.Sha.commitSha"
Public Shared BranchName As String = "feature1"
diff --git a/src/GitVersionTask.Tests/AssemblyLocation.cs b/src/GitVersionTask.Tests/AssemblyLocation.cs
index 34c9ab523c..519c7f2a15 100644
--- a/src/GitVersionTask.Tests/AssemblyLocation.cs
+++ b/src/GitVersionTask.Tests/AssemblyLocation.cs
@@ -3,12 +3,12 @@
public static class AssemblyLocation
{
- public static string CurrentDirectory()
- {
- var assembly = typeof(AssemblyLocation).Assembly;
- var uri = new UriBuilder(assembly.CodeBase);
- var path = Uri.UnescapeDataString(uri.Path);
+ public static string CurrentDirectory()
+ {
+ var assembly = typeof(AssemblyLocation).Assembly;
+ var uri = new UriBuilder(assembly.CodeBase);
+ var path = Uri.UnescapeDataString(uri.Path);
- return Path.GetDirectoryName(path);
- }
+ return Path.GetDirectoryName(path);
+ }
}
\ No newline at end of file
diff --git a/src/GitVersionTask.Tests/GitVersionTask.Tests.csproj b/src/GitVersionTask.Tests/GitVersionTask.Tests.csproj
index 09895c0294..341259e273 100644
--- a/src/GitVersionTask.Tests/GitVersionTask.Tests.csproj
+++ b/src/GitVersionTask.Tests/GitVersionTask.Tests.csproj
@@ -12,7 +12,7 @@
GitVersionTask.Tests
GitVersionTask.Tests
v4.5
- 5
+ 6
512
@@ -66,39 +66,19 @@
-
- ..\packages\Microsoft.CodeAnalysis.Common.1.2.1\lib\net45\Microsoft.CodeAnalysis.dll
+
+ ..\packages\Microsoft.CodeAnalysis.Common.1.3.2\lib\net45\Microsoft.CodeAnalysis.dll
True
-
- ..\packages\Microsoft.CodeAnalysis.CSharp.1.2.1\lib\net45\Microsoft.CodeAnalysis.CSharp.dll
+
+ ..\packages\Microsoft.CodeAnalysis.CSharp.1.3.2\lib\net45\Microsoft.CodeAnalysis.CSharp.dll
True
-
- ..\packages\Microsoft.CodeAnalysis.VisualBasic.1.2.1\lib\net45\Microsoft.CodeAnalysis.VisualBasic.dll
+
+ ..\packages\Microsoft.CodeAnalysis.VisualBasic.1.3.2\lib\net45\Microsoft.CodeAnalysis.VisualBasic.dll
True
-
- ..\packages\Microsoft.Web.Xdt.2.1.1\lib\net40\Microsoft.Web.XmlTransform.dll
- True
-
-
- ..\packages\NUnit3TestAdapter.3.4.1\lib\Mono.Cecil.dll
- True
-
-
- ..\packages\NUnit3TestAdapter.3.4.1\lib\Mono.Cecil.Mdb.dll
- True
-
-
- ..\packages\NUnit3TestAdapter.3.4.1\lib\Mono.Cecil.Pdb.dll
- True
-
-
- ..\packages\NUnit3TestAdapter.3.4.1\lib\Mono.Cecil.Rocks.dll
- True
-
..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll
True
@@ -107,20 +87,8 @@
..\packages\NSubstitute.1.10.0.0\lib\net45\NSubstitute.dll
True
-
- ..\packages\NUnit3TestAdapter.3.4.1\lib\nunit.engine.dll
- True
-
-
- ..\packages\NUnit3TestAdapter.3.4.1\lib\nunit.engine.api.dll
- True
-
-
- ..\packages\NUnit.3.4.1\lib\net45\nunit.framework.dll
- True
-
-
- ..\packages\NUnit3TestAdapter.3.4.1\lib\NUnit3.TestAdapter.dll
+
+ ..\packages\NUnit.3.6.0\lib\net45\nunit.framework.dll
True
@@ -132,13 +100,14 @@
True
-
- ..\packages\System.Collections.Immutable.1.1.37\lib\dotnet\System.Collections.Immutable.dll
+
+ ..\packages\System.Collections.Immutable.1.3.1\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll
True
+
-
- ..\packages\System.Reflection.Metadata.1.2.0\lib\portable-net45+win8\System.Reflection.Metadata.dll
+
+ ..\packages\System.Reflection.Metadata.1.4.2\lib\portable-net45+win8\System.Reflection.Metadata.dll
True
diff --git a/src/GitVersionTask.Tests/app.config b/src/GitVersionTask.Tests/app.config
index 43526a820e..3d12e16fad 100644
--- a/src/GitVersionTask.Tests/app.config
+++ b/src/GitVersionTask.Tests/app.config
@@ -8,11 +8,11 @@
-
+
-
+
diff --git a/src/GitVersionTask.Tests/packages.config b/src/GitVersionTask.Tests/packages.config
index e0e8ff5dd3..b56144aeb7 100644
--- a/src/GitVersionTask.Tests/packages.config
+++ b/src/GitVersionTask.Tests/packages.config
@@ -8,25 +8,24 @@
-
-
-
-
+
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/GitVersionTask/AssemblyInfoBuilder/CSharpAssemblyInfoBuilder.cs b/src/GitVersionTask/AssemblyInfoBuilder/CSharpAssemblyInfoBuilder.cs
index 9cb3c019e2..5fbb85721e 100644
--- a/src/GitVersionTask/AssemblyInfoBuilder/CSharpAssemblyInfoBuilder.cs
+++ b/src/GitVersionTask/AssemblyInfoBuilder/CSharpAssemblyInfoBuilder.cs
@@ -42,7 +42,7 @@ static class GitVersionInformation
}}
",
vars.AssemblySemVer,
- vars.MajorMinorPatch + ".0",
+ vars.AssemblySemFileVer,
vars.InformationalVersion,
GenerateStaticVariableMembers(v),
rootNamespace);
diff --git a/src/GitVersionTask/AssemblyInfoBuilder/UpdateAssemblyInfo.cs b/src/GitVersionTask/AssemblyInfoBuilder/UpdateAssemblyInfo.cs
index 53710a3292..26ec592ffb 100644
--- a/src/GitVersionTask/AssemblyInfoBuilder/UpdateAssemblyInfo.cs
+++ b/src/GitVersionTask/AssemblyInfoBuilder/UpdateAssemblyInfo.cs
@@ -6,6 +6,7 @@
using System.Text;
using GitVersion;
+ using GitVersion.Helpers;
using Microsoft.Build.Framework;
@@ -95,6 +96,7 @@ void CreateTempAssemblyInfo(VersionVariables versionVariables)
}
var assemblyInfo = assemblyInfoBuilder.GetAssemblyInfoText(versionVariables, RootNamespace).Trim();
+ var encoding = EncodingHelper.DetectEncoding(AssemblyInfoTempFilePath) ?? Encoding.UTF8;
// We need to try to read the existing text first if the file exists and see if it's the same
// This is to avoid writing when there's no differences and causing a rebuild
@@ -102,7 +104,7 @@ void CreateTempAssemblyInfo(VersionVariables versionVariables)
{
if (File.Exists(AssemblyInfoTempFilePath))
{
- var content = File.ReadAllText(AssemblyInfoTempFilePath, Encoding.UTF8).Trim();
+ var content = File.ReadAllText(AssemblyInfoTempFilePath, encoding).Trim();
if (string.Equals(assemblyInfo, content, StringComparison.Ordinal))
{
return; // nothign to do as the file matches what we'd create
@@ -114,7 +116,7 @@ void CreateTempAssemblyInfo(VersionVariables versionVariables)
// Something happened reading the file, try to overwrite anyway
}
- File.WriteAllText(AssemblyInfoTempFilePath, assemblyInfo, Encoding.UTF8);
+ File.WriteAllText(AssemblyInfoTempFilePath, assemblyInfo, encoding);
}
}
}
\ No newline at end of file
diff --git a/src/GitVersionTask/AssemblyInfoBuilder/VisualBasicAssemblyInfoBuilder.cs b/src/GitVersionTask/AssemblyInfoBuilder/VisualBasicAssemblyInfoBuilder.cs
index defe28dfd3..ec5efd38e9 100644
--- a/src/GitVersionTask/AssemblyInfoBuilder/VisualBasicAssemblyInfoBuilder.cs
+++ b/src/GitVersionTask/AssemblyInfoBuilder/VisualBasicAssemblyInfoBuilder.cs
@@ -38,7 +38,7 @@ End Sub
End Class
",
vars.AssemblySemVer,
- vars.MajorMinorPatch + ".0",
+ vars.AssemblySemFileVer,
vars.InformationalVersion,
GenerateStaticVariableMembers(v));
diff --git a/src/GitVersionTask/GetVersion.cs b/src/GitVersionTask/GetVersion.cs
index 0b95bcd96a..b873bd7052 100644
--- a/src/GitVersionTask/GetVersion.cs
+++ b/src/GitVersionTask/GetVersion.cs
@@ -66,6 +66,9 @@ public GetVersion()
[Output]
public string AssemblySemVer { get; set; }
+ [Output]
+ public string AssemblySemFileVer { get; private set; }
+
[Output]
public string FullSemVer { get; set; }
diff --git a/src/GitVersionTask/GitVersionTask.csproj b/src/GitVersionTask/GitVersionTask.csproj
index 08819d98f1..eede7e3313 100644
--- a/src/GitVersionTask/GitVersionTask.csproj
+++ b/src/GitVersionTask/GitVersionTask.csproj
@@ -11,7 +11,7 @@
GitVersionTask
GitVersionTask
v4.0
- 5
+ 6
512
$(SolutionDir)..\build\
@@ -79,9 +79,8 @@
-
- Designer
-
+
+
Designer
@@ -114,7 +113,7 @@
-
+
@@ -127,7 +126,8 @@
-
+
+
diff --git a/src/GitVersionTask/NugetAssets/GitVersionTask.targets b/src/GitVersionTask/NugetAssets/build/GitVersionTask.targets
similarity index 60%
rename from src/GitVersionTask/NugetAssets/GitVersionTask.targets
rename to src/GitVersionTask/NugetAssets/build/GitVersionTask.targets
index e0fc3cbc36..4093b0e2f3 100644
--- a/src/GitVersionTask/NugetAssets/GitVersionTask.targets
+++ b/src/GitVersionTask/NugetAssets/build/GitVersionTask.targets
@@ -1,15 +1,27 @@
+
+ True
+
$(MSBuildProjectDirectory)\..\
+ $(SolutionDir)
+ $(MSBuildProjectDirectory)
+ $(SolutionDir)\GitVersionTask.targets
+ $(SolutionDir)\GitVersionTask.targets
$(MSBuildProjectDirectory)\obj\$(Configuration)\
false
true
-
+
+ false
true
+
+
+ true
+ false
true
@@ -27,13 +39,15 @@
TaskName="GitVersionTask.WriteVersionInfoToBuildLog"
AssemblyFile="$(GitVersionTaskLibrary)GitVersionTask.dll" />
-
-
+
+
+
+
-
+
-
+
@@ -77,6 +91,18 @@
+
+
+ $(GitVersion_FullSemVer)
+ $(GitVersion_MajorMinorPatch)
+ $(GitVersion_NuGetPreReleaseTag)
+ $(GitVersion_PreReleaseTag)
+ $(GitVersion_NuGetVersion)
+ $(GitVersion_FullSemVer)
+ $(GitVersion_InformationalVersion)
+ $(GitVersion_AssemblySemVer)
+ $(GitVersion_MajorMinorPatch).$(GitVersion_CommitsSinceVersionSource)
+
@@ -93,6 +119,4 @@
-
-
-
+
\ No newline at end of file
diff --git a/src/GitVersionTask/NugetAssets/buildMultiTargeting/GitVersionTask.targets b/src/GitVersionTask/NugetAssets/buildMultiTargeting/GitVersionTask.targets
new file mode 100644
index 0000000000..b219ded70d
--- /dev/null
+++ b/src/GitVersionTask/NugetAssets/buildMultiTargeting/GitVersionTask.targets
@@ -0,0 +1,88 @@
+
+
+
+ True
+
+
+ $(MSBuildProjectDirectory)\..\
+ $(SolutionDir)
+ $(MSBuildProjectDirectory)
+ $(SolutionDir)\GitVersionTask.targets
+ $(SolutionDir)\GitVersionTask.targets
+ false
+
+
+ true
+
+
+ false
+ true
+
+ true
+
+
+ true
+ false
+
+ $(MSBuildThisFileDirectory)..\build\
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $(GitVersion_FullSemVer)
+ $(GitVersion_MajorMinorPatch)
+ $(GitVersion_NuGetPreReleaseTag)
+ $(GitVersion_PreReleaseTag)
+ $(GitVersion_NuGetVersion)
+ $(GitVersion_FullSemVer)
+ $(GitVersion_InformationalVersion)
+ $(GitVersion_AssemblySemVer)
+ $(GitVersion_MajorMinorPatch).$(GitVersion_CommitsSinceVersionSource)
+
+
+
+
\ No newline at end of file
diff --git a/src/GitVersionTask/packages.config b/src/GitVersionTask/packages.config
index e8e6abd4b5..8ebdf01da7 100644
--- a/src/GitVersionTask/packages.config
+++ b/src/GitVersionTask/packages.config
@@ -3,7 +3,7 @@
-
+
diff --git a/src/GitVersionTfsTask/manifest.json b/src/GitVersionTfsTask/manifest.json
index e796bd16e1..3c71b1f305 100644
--- a/src/GitVersionTfsTask/manifest.json
+++ b/src/GitVersionTfsTask/manifest.json
@@ -20,9 +20,11 @@
"categories": [
"Build and release"
],
- "icons": {
- "default": "extension-icon.png"
- },
+ "icons": [
+ {
+ "default": "extension-icon.png"
+ }
+ ],
"tags": [
"semver",
"git",