Search code examples
visual-studiomacrospost-build-event

How to add a build time to a file archive as a post-build macro?


I want to pack the project into a zip-file and have the build date time (or the current date time) as part of the zip-filename.

$(TargetDir)\7za.exe a release.zip *

So it would be nice to incorporate the date into the release.zip, something like release-14-3-2010-22_56.zip

Is it possible to define custom post-build macros?


Solution

  • You can call batch files as post build events.

    
    call "$(SolutionDir)zip.bat"
    

    and have the batch file read the date time.

    Here is an example