Auto Incrementing UWP and .NET Version Numbers

Here’s a few tips and tricks to allow assemblies to auto-increment their version number upon build.

UWP packages

c# - How do I auto increment the package version number? - Stack Overflow

In short, there should be a tag like this in the project csproj file:

<AppxAutoIncrementPackageRevision>True</AppxAutoIncrementPackageRevision>

For .NET apps

c# - How to have an auto incrementing version number (Visual Studio)? - Stack Overflow

Remove the AssemblyFileVersion attribute in the Properties/AssemblyInfo.cs file and use a star in the AssemblyVersion attribute:

[assembly: AssemblyVersion("2.10.*")]

Gotchas

It’s also worth noting that if both AssemblyVersion and AssemblyFileVersion are specified, you won’t see this on your .exe.

Setting only the 4th number to be * can be bad, as the version won’t always increment. The 3rd number is the number of days since the year 2000, and the 4th number is the number of seconds since midnight (divided by 2) [IT IS NOT RANDOM]. So if you built the solution late in a day one day, and early in a day the next day, the later build would have an earlier version number. I recommend always using X.Y.* instead of X.Y.Z.* because your version number will ALWAYS increase this way.