How to embed git hash to use in dotnet build
command to be able to catch it and put in build pipeline process as an environment variable ${hash}
and use ${hash}
environment variable in appsettings..json files for ASP.NET Core 2.1 WebAPI?
If you want to enable Git version information in your assembly, a good option is to use utilities like NerdBank.GitVersioning. It allows you to automatically calculate the version number based on the number of Git commits, include the Git commit SHA hash, and more.
You can use the nbgv .NET CLI tool or NerdBank.GitVersioning manually using a NuGet package.