Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to increment a version number programmatically?

How do I programmatically increment a given version's number to the next version of the highest one?

For example if I have a file Program.exe with the following version numbers :

Program.exe 1.0.0.0
Program.exe 1.0.0.4
Program.exe 1.1.0.76
Program.exe 1.0.0.66

The next version number in this case would be 1.1.0.77

What's the easiest way to implement that?

Thanks for any help in advance

like image 820
Kingamoon Avatar asked Jan 28 '10 00:01

Kingamoon


1 Answers

Use a version control solution, like Subversion or git, and/or a build tool.

Certainly a version control solution will provide functionality to insert version information into the source code as it is committed via a magic string you include in your source like $Rev$, which you can then use as a build number.

Here's a blog post showing how it's done with Subversion.

like image 76
brabster Avatar answered Oct 26 '22 22:10

brabster