DEV Community

Miro
Miro

Posted on

pre-commit autoincrement for c# projects

I was trying to figure out how to have autoincrement for c# projects that would work in the background, that would locally and that will not change on every build allowing you to build an app with the version stored in source control. And the result is this pre-commit script. It’s not perfect but it works for me. To use, put the file into .git\hooks\ folder in your project.

Top comments (2)

Collapse
 
jessekphillips profile image
Jesse Phillips

I've been trying to take an approach which provides some dev control and increasing version per commit.

Unlike yours the version is injected by the build system.

Collapse
 
milolav profile image
Miro

I'd say that versioning through build system is the correct way. Mine was pretty much just a simple hack that works offline and without any dependencies.