The approach I've normally used is to treat AssemblyInfo.cs
as the endpoint of such version numbers, not the start point.
So I'd start with a file that gets auto-generated or modified by the build process (eg by your CI system), eg
public static class BuildNumber
{
public const string Build = "<<git branch>>";
public const string Revision = "<<CI build number>>";
}
Then I have a versions class that holds all the version info:
public static class Versions
{
public static int Major { get { return Convert.ToInt32(MajorString); } }
public static int Minor { get { return Convert.ToInt32(MinorString); } }
public static int Build { get { return Convert.ToInt32(BuildNumber.Build); } }
public static int Revision { get { return Convert.ToInt32(BuildNumber.Revision); } }
public const string AssemblyVersion = MajorString + "." + MinorString + "." +
BuildNumber.Build + ". " + BuildNumber.Revision;
private const string MajorString = "1";
private const string MinorString = "2";
}
Finally, you put the following in your AssemblyInfo.cs
files:
[assembly: AssemblyVersion(Versions.AssemblyVersion)]
That way, the version info is then available within your code too, eg for displaying the version info in an about box.