Replies: 1 comment 2 replies
-
I prefer to follow the UNIX philosophy:
For MinVer, the "one thing" is determining the version for a commit based on the last tag in the history. The name of the currently checked out branch in the working directory has nothing to do with that, so providing that would be a very distinct "second thing" for MinVer to be doing. But as you've shown, there is something that does that—GitInfo. And because they both produce and consume the values of MSBuild properties, they work together and can be composed into a higher level use case such as the one you've shown. If GitInfo does more than that one thing, and that causes problems, then it's not following the same philosophy and it's a good demonstration of why that causes problems. But maybe there's another package that does follow the same philosophy? Or maybe that's your next package? 😉 |
Beta Was this translation helpful? Give feedback.
-
I'm aware of #758 that discusses how to embed git commit SHA into the
<InformationalVersion>
. In this discussionMicrosoft.SourceLink
is mentioned, but it's a very limited use-case that will work only for the commit SHA, right? Also I would avoid relying on any CI to set some envvars to provide the extra informations.Also the idea would be a bit different than directly embed a SHA or another info into the version. Instead I'm thinking more about setting some MSBuild variables that could then be used by some MSBuild targets if needed to customize the version. For thoses who are familar it's what GitInfo do here.
From my understanding it's not a flow that is currently in place within
MinVer
, MSBuild variables are only used as input to configure the versionning. Correct me if I'm wrong. So this would need a flow to create some output variables, that one could, optionnally use to customize the versioning.Here is an example of what I'm currently doing in my projects to give you a example:
So here
GitBranch
is set by GitInfo and then used for MinVer versioning. But I need a reference only for that and don't use the versionning of GitInfo. So I'd rather rely only on MinVer to be able to customize the version in such way.In the example above, it may not be a common use case where I use the branch to customize the pre-release id. However, I think it's pretty common to add git branch and/or hash to the build metadatas, etc. So it would probably be a great addition to the already excellent MinVer!
Beta Was this translation helpful? Give feedback.
All reactions