Can this tool be updated to work with GitVersion 4.0?
This is a really nice tool. However, I'm having trouble getting it to work with one of my projects which currently has a release branch checked out.
I'm using a Windows 7 machine. I've installed GitVersion 4.0.0-beta0011 using Chocolatey. Executing that in a Git Bash shell at my project root directory, I get this:
<me>@<my-computer> MINGW64 /c/Users/<me>/Documents/Visual Studio 2015/Projects/<product>web-core/src/<company>Group.<product>Web.Core (release/0.4.1)
$ gitversion
{
"Major":0,
"Minor":5,
"Patch":0,
"PreReleaseTag":"beta.1",
"PreReleaseTagWithDash":"-beta.1",
"PreReleaseLabel":"beta",
"PreReleaseNumber":1,
"BuildMetaData":13,
"BuildMetaDataPadded":"0013",
"FullBuildMetaData":"13.Branch.release/0.4.1.Sha.e282b5dfc7ad94e3395036b15c0052e0d33f498a",
"MajorMinorPatch":"0.5.0",
"SemVer":"0.5.0-beta.1",
"LegacySemVer":"0.5.0-beta1",
"LegacySemVerPadded":"0.5.0-beta0001",
"AssemblySemVer":"0.5.0.0",
"FullSemVer":"0.5.0-beta.1+13",
"InformationalVersion":"0.5.0-beta.1+13.Branch.release/0.4.1.Sha.e282b5dfc7ad94e3395036b15c0052e0d33f498a",
"BranchName":"release/0.4.1",
"Sha":"e282b5dfc7ad94e3395036b15c0052e0d33f498a",
"NuGetVersionV2":"0.5.0-beta0001",
"NuGetVersion":"0.5.0-beta0001",
"NuGetPreReleaseTagV2":"beta0001",
"NuGetPreReleaseTag":"beta0001",
"CommitsSinceVersionSource":13,
"CommitsSinceVersionSourcePadded":"0013",
"CommitDate":"2017-03-13"
}
However, if I try dotnet gitversion instead, I get this:
<me>@<my-computer> MINGW64 /c/Users/<me>/Documents/Visual Studio 2015/Projects/<product>web-core/src/<company>Group.<product>Web.Core (release/0.4.1)
$ dotnet gitversion
INFO [03/14/17 14:11:02:98] IsDynamicGitRepository: False
INFO [03/14/17 14:11:02:98] Returning Project Root from DotGitDirectory: C:\Users\<me>\Documents\Visual Studio 2015\Projects\<product>web-core\.git - C:\Users\<me>\Documents\Visual Studio 2015\Projects\<product>web-core
INFO [03/14/17 14:11:02:98] Project root is: C:\Users\<me>\Documents\Visual Studio 2015\Projects\<product>web-core
INFO [03/14/17 14:11:02:98] DotGit directory is: C:\Users\<me>\Documents\Visual Studio 2015\Projects\<product>web-core\.git
INFO [03/14/17 14:11:03:05] Begin: Loading version variables from disk cache
INFO [03/14/17 14:11:03:07] Cache file C:\Users\<me>\Documents\Visual Studio 2015\Projects\<product>web-core\.git\gitversion_cache\AD0D68ED6C337805CD0FC9935E88189B6E34E410.yml not found.
INFO [03/14/17 14:11:03:07] End: Loading version variables from disk cache (Took: 23.02ms)
INFO [03/14/17 14:11:03:16] Using latest commit on specified branch
Unhandled Exception: System.Exception: Multiple branch configurations match the current branch branchName of 'release/0.4.1'. Matching configurations: 'release, releases?[/-]'
at GitVersion.BranchConfigurationCalculator.GetBranchConfiguration(Commit currentCommit, IRepository repository, Boolean onlyEvaluateTrackedBranches, Config config, Branch currentBranch, IList`1 excludedInheritBranches)
at GitVersion.GitVersionContext.CalculateEffectiveConfiguration()
at GitVersion.GitVersionContext..ctor(IRepository repository, Branch currentBranch, Config configuration, Boolean onlyEvaluateTrackedBranches, String commitId)
at GitVersion.GitVersionContext..ctor(IRepository repository, Config configuration, Boolean isForTrackingBranchOnly, String commitId)
at GitVersion.ExecuteCore.ExecuteInternal(String targetBranch, String commitId, IRepository repo, GitPreparer gitPreparer, String projectRoot, IBuildServer buildServer, Config overrideConfig)
at GitVersion.ExecuteCore.ExecuteGitVersion(String targetUrl, String dynamicRepositoryLocation, Authentication authentication, String targetBranch, Boolean noFetch, String workingDirectory, String commitId, Config overrideConfig)
at ConsoleApplication.Program.Main(String[] args)
I'm using this GitVersion.yml file in my solution root directory (which the project root directory is located under):
next-version: 0.5.0
branches:
master:
increment: None
release:
increment: None
feature:
increment: None
pull-request:
increment: None
hotfix:
increment: None
support:
increment: None
develop:
increment: None
ignore:
sha: []
The issue appears to be caused by the fact that I've adapted my GitVersion.yml to work with GitVersion 4, but this involves breaking changes from previous versions. According to the docs, branch-specification configuration uses named configs rather than regular expressions for keys.
Looking at the project.json for this project, it looks like it's using your forked version of GitVersion. If that's the case, I believe the following steps are required:
- Merge GitTools:master back into ah-:master for your forked version of GitVersion
- Make all necessary changes to the merged code to make it run on .NET Core
- Publish a new version of
GitVersionCore-dotnet - Specify the new version of
GitVersionCore-dotnetas a dependency in this project'sproject.json - Publish a new version of
dotnet-gitversion