MSBuild and Custom AssemblyVersion Attributes
I've just started working on getting into MSBuild, one of the first tasks that I'm looking to accomplish is the ability to have MSBuild generate custom assembly version numbers. I'd like to be able to do a build and have MSBuild generate a assembly version number something like 1.0.40615.22 where 4 is the year, 06 is the month, 15 is the day and 22 is the hour (military time). I know i could write a task to actually edit the assemblyinfo.cs file (well truth be told i'm not entirely sure how to do this :( but i can figure this out without too much trouble). What I'd really like though is to have the task completely ignore the AssemblyVersion attribute and always generate the custom number N.N.YMMDD.HH (perhaps i have the AssemblyVersion attribute omitted). I'd like to not edit the assemblyinfo.cs file on every build to stay away from source control issues. I don't really want to get into having to check out and check in the file every time. What i don't really understand is why this isn't built directly into the AssemblyVersion attribute itself, you can already specify 1.0.* to have it generate a time based version number (i believe its time based, but not entirely sure)
What's the easiest way of accomplishing this task? Perhaps a nice solution would be to specify the YMMDD.HH in the AssemblyInfo.cs file directly which would at runtime be translated but not require editing the file on a per build basis. I think this is what I'm going to shoot for. I think this version number scheme is similar to the one that Microsoft uses, but they've probably got a much more involved and complicated build system than I'm looking to employ. Does anyone know of how to accomplish this through (or something similar) through a custom msbuild task and not involve editing the AssemblyInfo.cs file?
Scott