Adding build date/time/count to your C# project
Monday, December 21st, 2009This is pretty much a straight-forward conversion of http://www.dirty-motherfucker.org/blog/2009/04/24/build-count-of-vc-project-for-version-string/
I was quite pissed that there is no easy option to get something as simple as the build date into your C# project.
So here is my pre-build script I use in my C# projects:
@echo off
SETLOCAL
set TARGET_PATH=%~dp0
set IN_FILENAME="%TARGET_PATH%Version.txt"
set OUT_FILENAME="%TARGET_PATH%Version.cs"
set /p BUILD= < %IN_FILENAME%
set BUILD=%BUILD:~22%
if /I "%BUILD%" == "" [...]
