Marcin Gil
Marcin Gil

Reputation: 69535

git build number c#

I'm trying to embed git describe-generated version info into AssemblyInfo.cs plus some label within ASP.NET website.

I already tried using git-vs-versionino but this assumes Git executable on PATH. However default install of msysgit on Windows does not set this up; it uses git bash. This caused problems.

Now I am looking for a way to utilize libgit2sharp library (for zero external dependencies) to use as build number generator. However this library has no describe command...

Thanks!

Upvotes: 2

Views: 798

Answers (2)

nulltoken
nulltoken

Reputation: 67639

There's a work in progress libgit2 pull request that proposes an implementation of git-describe functionalities.

See #1066 for more information.

It's not finished yet. Make sure to subscribe to it in order to be notified of its future progress.

Once it's done, it should be quite easy to bind it and make it available through LibGit2Sharp.

Upvotes: 1

Carlos Martín Nieto
Carlos Martín Nieto

Reputation: 5277

git-describe is a UI feature that nobody has implemented in the library or bindings yet (or at least nobody's contributed it), but you can do it yourself fairly easily.

You get a list of the tags and what commits they point to, do a walk down the commits and count how many steps it took to get to a commit that you have in the list you built. This already gives you the information you need. If the steps were zero, then your description would be the tag name only; otherwise you append the number of steps and the current commit's id to it.

Upvotes: 1

Related Questions