I would use git describe
in order to get an id representing the tag/SHA1 of the current commit, and integrate it in your Assembly file.
v1.0-2-g2414721-DEV
^ ^ ^ ^
| | | \-- if a dirtyMarker was given, it will appear here if the repository is in "dirty" state
| | \---------- the "g" prefixed commit id. The prefix is compatible with what git-describe would return - weird, but true.
| \------------- the number of commits away from the found tag. So "2414721" is 2 commits ahead of "v1.0", in this example.
\----------------- the "nearest" tag, to the mentioned commit.
It is similar to "Automatically versioning Android project from git describe with Android Studio/Gradle", but to be adapted to vb.net.
Or you can have "fake revision number".
For a more complete build Assembly file generation, see that maven plugin "maven-git-commit-id-plugin
" (again, to be adapted to a vb.net build).
It can generate a file as complete as:
{
"branch" : "testing-maven-git-plugin",
"describe" : "v2.1.0-2-g2346463",
"commitTime" : "06.01.1970 @ 16:16:26 CET",
"commitId" : "787e39f61f99110e74deed68ab9093088d64b969",
"commitIdAbbrev" : "787e39f",
"commitUserName" : "Konrad Malawski",
"commitUserEmail" : "konrad.malawski@java.pl",
"commitMessageFull" : "releasing my fun plugin :-)
+ fixed some typos
+ cleaned up directory structure
+ added license etc",
"commitMessageShort" : "releasing my fun plugin :-)",
"buildTime" : "06.01.1970 @ 16:17:53 CET",
"buildUserName" : "Konrad Malawski",
"buildUserEmail" : "konrad.malawski@java.pl"
}
That illustrates how you can ask the git repo for all kind of different information (not just the date, but the branch, committer, commit message, ...).
See the DescribeCommand.java
for more details on the implementation.