Can I get the height during build? #987
-
I'd like to use a 4-component version number where 1.0.0-beta.123 gets file version 1.0.0.123, so I'd like to access the git height. Is this possible? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Solution I'm using at the moment: parsing it from the SemVer. This solves the problem. <Height>$([System.Text.RegularExpressions.Regex]::Match($(MinVerPreRelease), `\w+\.(\d+)$`).Groups[1].Captures)</Height>
<FileVersion>$(MinVerMajor).$(MinVerMinor).$(MinVerPatch).$(Height)</FileVersion> |
Beta Was this translation helpful? Give feedback.
-
123 is not the git height in the example you've given. MinVer will only calculate that version from a tag, so you must have tagged the commit with I would advise against parsing the height. As stated in the FAQ, the official guidance for assembly file version states:
The FAQ shows how to do that. |
Beta Was this translation helpful? Give feedback.
Solution I'm using at the moment: parsing it from the SemVer. This solves the problem.