1

I am trying to figure out how to auto increment the version number (1.0.**) every time I publish. I have found a lot of examples doing this on build, but not on publish.

Please note: I am not looking to do this by date. I would like this to increment once per publish, not per day.

Thank you for your help!

Tatranskymedved
  • 4,194
  • 3
  • 21
  • 47
ehelmick93
  • 27
  • 5
  • 3
    Generally you shouldn't be publishing directly from your machine. Instead, you'd use a build server such as Azure DevOps, GitHub Actions, Jenkins etc. You can wire those up to update the version based on whatever you want, such as using [gitversion](https://github.com/GitTools/GitVersion). You might also consider using git tags to trigger your builds intended for production. – mason Dec 14 '20 at 18:13
  • 2
    If you *really* want to publish from your machine for some reason, there's nothing preventing you from building/publishing from a script. That script can perform the publish, and do any version updating however you want. – mason Dec 14 '20 at 18:15
  • 1
    Such a script might check to make sure the current work is committed. Then it would compile the app and run any unit tests. If there's uncommitted work or failing unit tests, then it would exit. If that all passes, it could update the version number, commit, then perform the publish (and possibly tag the commit with the version number). The possibilities are endless, you just need to sit down and think through what you want your process to look like and then make it happen. – mason Dec 14 '20 at 19:11

0 Answers0