I just wrote this short little program to increment up the build number for my projects every time I build them.
After compiling this exe, I just call it in the pre-build command line.
I did take out the filename string because I used it twicethrice, and I figured I'd get some flack for thatif I didn't.
static void Main() { int num; string file = "AssemblyInfo.cs"; if (File.Exists(file)) File.WriteAllLines(file, File.ReadAllLines(file).Select(s => !s.Trim().StartsWith("[assembly: AssemblyFileVersion(") ? s : string.Join(".", s.Trim(']').Trim(')').Trim('"').Split('.').Select((n, i) => i != 3 ? n : !int.TryParse(n, out num) ? n : (num + 1).ToString())) + "\")]")); } I realize this is complex, and the average person wont be able to read it. I use magic numbers, and I do some things specifically to keep the glory on 1 line. Feel free to bask in the presence of psychedelic code (which just wants to be your friend).