Package: Invex.Atom.Module.GitVersion
Integrates GitVersion to provide automatic build ID and version numbers based on your Git history.
dotnet add package Invex.Atom.Module.GitVersionImplement IGitVersion and enable the corresponding build options:
[BuildDefinition]
[GenerateEntryPoint]
internal partial class Build : BuildDefinition, IGitVersion
{
public override IReadOnlyList<IBuildOption> Options =>
[
BuildOptions.GitVersion.ProvideBuildId,
BuildOptions.GitVersion.ProvideBuildVersion,
];
// BuildId and BuildVersion are now sourced from GitVersion.
}When IGitVersion is implemented, the module registers:
GitVersionBuildIdProviderasIBuildIdProviderGitVersionBuildVersionProviderasIBuildVersionProvider
These replace the default providers, so BuildId and BuildVersion in your IBuildInfo are automatically populated
from GitVersion output.
Important
The providers only activate when the corresponding flag is enabled in Options. If IGitVersion is implemented but
a flag is missing, resolving BuildId / BuildVersion throws an error telling you to enable the flag. This lets you
opt in to GitVersion for the version, the ID, or both.
GitVersion must be available as a .NET tool. Install it globally or as a local tool:
dotnet tool install --global GitVersion.ToolConfigure it via GitVersion.yml in your repository root.