You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was really excited at first when I found your project, but due to the limits of constant expressions in C# I'm not able to get it to produce the versions that I need.
Specifically, if the base version is "v2.0.0 then I want "v2.0.1-dev.<commits>." The problem is in the patch number. I basically need ThisAssembly.Git.BaseVersion.Minor + 1. Of course, that can't be done because the minor version is a string and converting between strings and integers isn't possible in constant expressions.
Is there a way I can override the $(GitSemVerPatch) variable to be what I want?
In general, doesn't the limitation to constant expressions really make this approach not work well?
The text was updated successfully, but these errors were encountered:
You can inspect the targets and just place a new MSBuild target (typically in your Directory.Build.targets) in-between those to tweak the versions as you see fit. i.e.:
You can do math or regexes or anything really, just like the targets do to calculate the semver values.
What's important to realize is that all processing is done in build, so by the time the compiler sees the constants, whey are already all pre-calculated. This also means you can use those same values for anything else, not just code (i.e. append the version # to the output file name, such as in an MSI or a VSIX).
I was really excited at first when I found your project, but due to the limits of constant expressions in C# I'm not able to get it to produce the versions that I need.
Specifically, if the base version is "v2.0.0 then I want "v2.0.1-dev.<commits>." The problem is in the patch number. I basically need
ThisAssembly.Git.BaseVersion.Minor + 1
. Of course, that can't be done because the minor version is a string and converting between strings and integers isn't possible in constant expressions.Is there a way I can override the
$(GitSemVerPatch)
variable to be what I want?In general, doesn't the limitation to constant expressions really make this approach not work well?
The text was updated successfully, but these errors were encountered: