I'm using MinVer and can't find how to get the commit height to create a custom version suffix. Ideally I would like to have 1.0.0-preview.{commits} instead of 1.0.0.-preview.0.{commits}. What the zero between the pre-release label and commit height is I don't know. (Yes, I've set <MinVerDefaultPreReleasePhase>
to preview :))
Secondly, using GitInfo I notice a discrepancy in the number of commits. Below is output from some me experimenting on github
$ dotnet Application.dll
========== Git ==========
Commit a54e9e9
Commit SHA a54e9e96868470ebf13d4a35ce9858c09a534363
Branch remotes/origin/master
Tag
Commits 39
========== Assembly ==========
Version 1.0.0
Assembly Not found: AssemblyVersionAttribute
Informational 1.0.0-preview.0.34+a54e9e96868470ebf13d4a35ce9858c09a534363
File 1.0.0.24 // AzDo BuildId=24
Diagnosing MinVer gives me some hints about a root commit, but I know to little about git what determines the root commit.
MinVer: Starting at commit a54e9e9 (height 0)...
MinVer: History diverges from 3c0633f (height 20) to:
MinVer: - 56af0a5 (height 21)
MinVer: - 747ef5a (height 21)
MinVer: Following path from 3c0633f (height 20) through first parent 56af0a5 (height 21)...
MinVer: Found root commit { Commit: faa505b, Tag: null, Version: 0.0.0-preview.0, Height: 34 }.
MinVer: Backtracking to 3c0633f (height 20) and following path through last parent 747ef5a (height 21)...
MinVer: History converges from 0f35453 (height 24) back to previously seen commit 8dc52dc (height 25). Abandoning path.
MinVer: 39 commits checked.
MinVer: No commit found with a valid SemVer 2.0 version prefixed with ''. Using default version 0.0.0-preview.0.
MinVer: Using { Commit: faa505b, Tag: null, Version: 0.0.0-preview.0, Height: 34 }.
So, to summarize:
- How do I customize version suffix for MinVer?
- What does the zero {MinVerDefaultPreReleasePhase}.0.{commits} represent?
- How is the commit height calculated/determined?
Third question leads me into versioning of NuGet and the section about FileVersionAssembly specifically the Revision-part of version number. But I leave this for another question.
Note I tried to add the tag minver
but couldn't due to low reputation :)
Thanks
Joakim
I assume that "version suffix" refers to the pre-release identifiers. You can't customise all of them, only the default pre-release phase, which you are already doing with
MinVerDefaultPreReleasePhase
.It's a sentinel value that represents interim versions before the next version is released. Bear in mind that a fundamental assumption in MinVer is that you label before release, so you will never release one of these versions. E.g. the current commit may be building
0.0.0-preview.0.34
. When you want to release your first preview, you'd tag the commit with1.0.0-preview.1
and MinVer will embed that version into your assemblies and package.This is explained in "How it works":
and from the FAQ:
You can also see, in excruciating detail, how MinVer walks the history: