NuGet Package Git and SemVer info for MSBuild/C#/VB

Exposes the following information for use directly from MSBuild, C#, F# and VB:
$(GitBranch), ThisAssembly.Git.Branch
$(GitCommit), ThisAssembly.Git.Commit
$(GitSha), ThisAssembly.Git.Sha
$(GitBaseVersionMajor), ThisAssembly.Git.BaseVersion.Major
$(GitBaseVersionMinor), ThisAssembly.Git.BaseVersion.Minor
$(GitBaseVersionPatch), ThisAssembly.Git.BaseVersion.Patch
$(GitCommits), ThisAssembly.Git.Commits
$(GitTag), ThisAssembly.Git.Tag
$(GitBaseTag), ThisAssembly.Git.BaseTag
$(GitSemVerMajor), ThisAssembly.Git.SemVer.Major
$(GitSemVerMinor), ThisAssembly.Git.SemVer.Minor
$(GitSemVerPatch), ThisAssembly.Git.SemVer.Patch
$(GitSemVerLabel), ThisAssembly.Git.SemVer.Label
$(GitSemVerDashLabel), ThisAssembly.Git.SemVer.DashLabel
$(GitSemVerSource), ThisAssembly.Git.SemVer.Source
$(GitIsDirty), ThisAssembly.Git.IsDirty

The generated code contains only constants, so it can be used to construct your own assembly/file version attributes:

[assembly: AssemblyVersion(ThisAssembly.Git.SemVer.Major + "." + ThisAssembly.Git.SemVer.Minor + ".0")]
[assembly: AssemblyInformationalVersion(ThisAssembly.Git.SemVer.Major + "." +
ThisAssembly.Git.SemVer.Minor + "." + ThisAssembly.Git.SemVer.Patch + "-" +
ThisAssembly.Git.Branch + "+" + ThisAssembly.Git.Commit)].

Info

Version: 2.1.2
Author(s): Daniel Cazzulino
Last Update: Thursday, September 24, 2020
.NET Fiddle: Create the first Fiddle
Project Url: https://github.com/kzu/GitInfo
NuGet Url: https://www.nuget.org/packages/GitInfo


Install
Install-Package GitInfo
dotnet add package GitInfo
paket add GitInfo
GitInfo Download (Unzip the "nupkg" after downloading)

5 packages depend on this package.


Tags



STATS

must-have-score

6

avg-downloads-per-day

666

days-since-last-release

67