I use the build in mechanism to automatically generate the 3rd (version) and 4th (revision) parts of the build number. The 3rd value is the day of the build and the 4th value is a value representing the minutes within the day. So in assemblyInfo.cs have: [assembly: AssemblyVersion("4.1.*")] I have the major and minor set to 4.1 but these can be set to any numbers. To retrieve the full version number values use: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Reflection; using System.Diagnostics; using System.IO; static int Main(string[] args) { Assembly assembly = Assembly.GetExecutingAssembly(); FileVersionInfo fileVersionInfo = FileVersionInfo.GetVersionInfo(assembly.Location); string version = fileVersionInfo.ProductVersion; int majorNo = fileVersionInfo.FileMajorPart; int minorNo = fileVersionInfo.FileMinorPart; int buildNo = fileVersionInfo.ProductBuildPart; int revisionNo = fileVersionInfo.ProductPrivatePart; }
P
Patrick Hendry 2021
@Patrick Hendry 2021
Posts
-
any tips to share on Build number maintainence? -
Math(s) problem - puzzleYour answer is wrong, but not because of maths but because of your English usage. Your intention is to say the answer is 5 factorial in which case your first sentence would end with: "and announced that the answer was 5!." However, by leaving off the period, the exclamation mark ends the sentence, which means you are actually saying the answer is 5. I realize leaving off the period was deliberate to make the trick work, but it's inaccurate, and we are all engineers here :)