Is there any way to generate some C# constant which values is the name of the current branch?
My goal is to generate something like this:
public static Constants {
public const string MyProductVersionName = "release/V0.2";
}
(release/V0.2
is the name of the current branch).
My question applies both to TFS 2013 and/or GIT, as I'm evaluating both source control services.
I look at Tf Command-Line Utility Commands to see if I can tweak a pre build event, but I didn't find how to get the current branch name.
Using git, I found in another answer on SO this command line:
git rev-parse --abbrev-ref HEAD
This works fine.
In both case, what would be the correct way to generate such file?