cost
cost

Reputation: 4480

Can Visual Studio 2013 tag a git commit with the current assembly version

I just updated a project to VS 2013 and hooked my bitbucket account into it. Everything looks to be committing and pushing fine. According to MSDN link, Git for VS 2013 doesn't support pushing tags, and say it needs to be done through the command line interface. I'd like to use tags to track the version number of my various commits, and the version number is conveniently stored in the assembly information of my project.

I'd like to commit whatever the current version number is for my project, is there any way to do this aside from manually trying it into the command line every time? I assume there isn't, but SO is fully of clever people, so I thought I'd at least ask.

Upvotes: 3

Views: 3070

Answers (1)

VonC
VonC

Reputation: 1327384

I'd like to commit whatever the current version number is for my project

That isn't the adequate step for a version number: you generate it from your source control and integrate it in your build process, in order for your exe to reflect the state of the source repo.

The command to use is git describe --long.

See "Embed git commit hash in a .Net dll"

enter image description here

In short, don't mix metadata about the sources (like a git tag/SHA1) with the sources themselves.
Reserve that for your exe (the end-result you are building from the sources).

Upvotes: 4

Related Questions