Closed ctaggart closed 5 years ago
I'm not sure why SourceLink
would be where you'd turn to address a versioning requirement. Isn't that a very different use case than PDB-related concerns that SourceLink
addresses?
@AArnott Yes, I could create a whole different project. In the past, I've used this as an umbrella project for utilities. Not sure yet what I prefer. Ideally, a tool like Nerbank.GitVersioning would already provide a close enough solution that I could live with.
So which requirements do you need that GitVersion or NB.GV do not deliver?
Your desire to get version info from tags suggest GitVersion may be a better fit, since NB.GV always gets it from a version.json file. But from what I hear, GitVersion has some significant limitations that may be important to you.
Regarding Version, VersionPrefix, & VersionSuffix, here is how the .NET SDK handles it: https://github.com/dotnet/sdk/blob/master/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.DefaultAssemblyInfo.targets
<PropertyGroup Condition=" '$(Version)' == '' ">
<VersionPrefix Condition=" '$(VersionPrefix)' == '' ">1.0.0</VersionPrefix>
<Version Condition=" '$(VersionSuffix)' != '' ">$(VersionPrefix)-$(VersionSuffix)</Version>
<Version Condition=" '$(Version)' == '' ">$(VersionPrefix)</Version>
</PropertyGroup>
I'm not sure if PreReleaseVersionLabel
is replacing VersionSuffix
, but it is being used in some Microsoft projects https://github.com/dotnet/sourcelink/pull/191/files#r225758664
I'm most interested in using Netbank.GitVersioning by @AArnott if I can get https://github.com/AArnott/Nerdbank.GitVersioning/pull/304 merged.
gah! I need to review that. Sorry for the delay.
I've been using & contributing to GitVersioning. http://blog.ctaggart.com/2019/04/automate-your-net-versioning-with.html
I'm tempted to make a executable that outputs a version for use in build environments that I use: AppVeyor, TeamCity, TravisCI, BitRise, Azure Pipelines. I've implemented this logic multiple times in various types of scripts. It boils down to this:
-build.0
where 0 is the build number of the CI servicehttps://github.com/ctaggart/SourceLink/blob/master/build.ps1#L1-L16
I like how @panesofglass modified what I did to pull the version from the project file. https://github.com/xyncro/chiron/blob/master/build.ps1#L1-L3
Question:
VERSION
Evaluate existing alternatives: