Monday, January 05, 2009

Timestamping F# assembly versions

Following up to the previous post, with this script Timestamp.fsx (unchanged by the Feb 2010 CTP, but enhanced to show the current year when it is no longer 2009):

suitably adjusted to taste in your main project folder, and a pre-build step of

cd ..\..
"C:\Program Files\FSharp-\bin\fsi.exe" --exec Timestamp.fsx

or in the Feb 2010 CTP

cd ..\..
"C:\Program Files\FSharp-\bin\fsi.exe" --exec Timestamp.fsx

you can get an automatically timestamped assembly, as per a C# 1.0.* version.

Note that using [< assembly: AssemblyVersion(\"1.0.*\") >] gives an assembly version of in the DLL manifest, and no file version whatsoever.

You will have to bootstrap the process by creating a dummy AssemblyInfo.fs, and adding it to the project -- but of course not checking it in to source control or anything like that, since it is recreated every build.

Later: If the 4th facet exceeds 32k, it ends up set to zero, so change the factor to 3 in let revision= ((int fraction.TotalSeconds) / 3) for those end-of-UTC-day builds...

No comments :