Wednesday, October 28, 2009

AutoCopy, AutoZip

Back before we were using any form of version control I came up with a temporary solution that would automatically copy the latest build of a project to a network share. It would also zip the entire solution folder up to another folder on that network share. Perhaps this format will prove useful again someday or to someone else.

Pre-Build section of your project:

if not exist "Z:\Technology\VisualStudio2005\Built\$(ProjectName)\" mkdir "Z:Technology\VisualStudio2005\Built\$(ProjectName)\"
del "Z:\Technology\VisualStudio2005\Built\$(ProjectName)\*.lnk"
del "Z:\Technology\VisualStudio2005\Built\$(ProjectName)\*.tmp"

Post-Build section

copy /y "$(TargetDir)*.*" "Z:\Technology\VisualStudio2005\Built\$(ProjectName)\"
REM stop here if you don't want the auto zipping part
cd "$(ProjectDir).."
REM the next line gets the current date,month, year from the OS into a single string format ( 2009.10.28)
for /f "tokens=2,3,4 delims=/ " %%a in ('date /t') do set bdate=%%a.%%b.%%c
REM includes the current username so that two people working on the same project would have their own latest changes saved
pkzipc -add -overwrite -dir=current "Z:\Technology\VisualStudio2005\Project Zips\$(ProjectName)" "$(ProjectDir)*"

No comments:

Post a Comment