Automatically update project version on package

Hello everyone,
I wanted to update my project version number every time i package my game.
I followed this post Automatically updating the Project Version # when project builds (two solutions) but this updates the project version every time i build even in visual studio, and i get a lot of commits in perforce which i don’t want.
Is there a way to call the C# program whenever the packaging phase starts instead of the build phase?

Thanks!

For the current project, this is what I did in our Jenkins build:

  • Jenkins builds the editor
  • A jenkins build task checks out the config file after syncing to latest
  • Then, jenkins runs a commandlet (the solution you linked to)
  • The P4 changelist # is encoded into the version #
  • Jenkins then submits the config file change
  • Then, the build proceeds
  • There’s no source control code in the commandlet, I just let jenkins manage Perforce here. Simpler & more convenient.

If you have Jenkins maybe that’ll help. Happy to add more info if needed.

We currently do not use Jenkins, if there’s another way to do it without it, it would be awesome. Otherwise we would have to look into integrating Jenkins in our project