GmodNET.VersionTool 2.1.0

dotnet tool install --global GmodNET.VersionTool --version 2.1.0
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest # if you are setting up this repo
dotnet tool install --local GmodNET.VersionTool --version 2.1.0
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=GmodNET.VersionTool&version=2.1.0
nuke :add-package GmodNET.VersionTool --version 2.1.0

GmodNET Version Tool

MSBuild Target NuGet Link Class Library NuGet Link CLI Tool NuGet Link

A git-based Semantic Versioning 2.0.0 compatible version number generator.

Description

GmodNET Version Tool generates a version number of the form [FullVersion]+codename.[codename from version JSON file].head.[git head name].commit.[hexadecimal representation of git commit hash].[any additional metadata provided in a "Version" key-value pair of the version JSON file] based on the version file and git repository state.

Version file is a JSON file containing key Version with corresponding value being a Semantic Versioning 2.0.0 compatible version base (initial part of the resulting version) and optional key Codename.

For example, given that repository HEAD points to NewFeature branch and version file

{
  "Version": "0.6.0-beta.1"
}

the resulting version will be equal to

0.6.0-beta.1.943586.NewFeature+head.NewFeature.commit.a3455d90049f17b6ac3bbc54177cfb51b0803851

or given that git HEAD points to master branch and version file

{
  "Version": "1.0.0+bugfix14",
  "Codename": "Ural"
}

the resulting version will be equal to

1.0.0+codename.Ural.head.master.commit.e796d2d62d39256f9c3e55b3648cd2bfb289e7bc.bugfix14.

You can read about version number generation in more detail in the Version Tool specification.

Usage

The most straightforward way to use GmodNET Version Tool with .NET projects is to consume GmodNET.VersionTool.MSBuild NuGet package. Just add package reference and specify version file to use by adding similar ItemGroup to your MSBuild project:

<ItemGroup>
  <PackageReference Include="GmodNET.VersionTool.MSBuild" Version="2.0.0" PrivateAssets="All"/>
  <VersionFile Include="../version.json" />
</ItemGroup>

GmodNET.VersionTool.MSBuild will automatically generate version number and set Version and PackageVersion properties for each build.

GmodNET.VersionTool.SourceGenerator is a C# Source Generator, which provides functionality similar to GmodNET.VersionTool.MSBuild, but embeds build version information directly as C# code.

There is a cross-platform .NET command line tool implementation of GmodNET Version Tool: GmodNET.VersionTool. It can be used from shell or any other build systems like make, cmake, etc.

GmodNET.VersioTool.Core is a NuGet package containing .NET Standard 2.0 class library which can be used to generate version numbers from other .NET applications.

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last updated
2.1.0 3,061 11/25/2021
2.0.0 1,032 7/11/2021
1.0.1 687 12/26/2020
1.0.0 514 12/26/2020