Use conditional build events to freshen zip files in Visual Studio
I wanted to update a couple zip files of the VB version of my Blog Crawler (to be posted soon) with the latest and greatest when I built the Release version of a project. I used the XCOPY command with the /D option to update only if changed. Copying to a ZIP file extension actually puts the file into the ZIP file. Is this a feature of Win XP or Winzip? I suspect it’s Win XP Compressed folder behavior. Nice.
In VS 2005 (the steps for prior VS versions are slightly different), choose Project->Properties->Compile. Build Events.
I didn’t see a way to make the build events run conditionally depending on configuration: Debug or Release, nor did these configurations have their own separate settings. So, I used the IF command.
For the Post-Build Event, I added these lines using the build event editor and the Macros dialog to help build the strings.
if $(ConfigurationName)==Release xcopy /df $(ProjectDir)$(TargetName)*.vb $(ProjectDir)$(TargetName)Source.zip
if $(ConfigurationName)==Release xcopy /df $(TargetDir)$(TargetName)$(TargetExt) $(ProjectDir)$(TargetName)Runtime.zip
Choose: “Run the post build event:“ On Successful Build
In the Output Build window, the commands are echoed with the macros expanded, and the results are shown:
BlogCrawl -> d:\dev\vb\BlogCrawl\bin\Release\BlogCrawl.exe
if Release==Release xcopy /df d:\dev\vb\BlogCrawl\BlogCrawl*.vb d:\dev\vb\BlogCrawl\BlogCrawlSource.zip
if Release==Release xcopy /df d:\dev\vb\BlogCrawl\bin\Release\BlogCrawl.exe d:\dev\vb\BlogCrawl\BlogCrawlRuntime.zip
D:\dev\vb\BlogCrawl\BlogCrawl.vb -> D:\dev\vb\BlogCrawl\BlogCrawlSource.zip
1 File(s) copied
D:\dev\vb\BlogCrawl\bin\Release\BlogCrawl.exe -> D:\dev\vb\BlogCrawl\BlogCrawlRuntime.zip
1 File(s) copied
Of course, when building the Debug version the output is different:
BlogCrawl -> d:\dev\vb\BlogCrawl\bin\Debug\BlogCrawl.exe
if Debug==Release xcopy /df d:\dev\vb\BlogCrawl\BlogCrawl*.vb d:\dev\vb\BlogCrawl\BlogCrawlSource.zip
if Debug==Release xcopy /df d:\dev\vb\BlogCrawl\bin\Debug\BlogCrawl.exe d:\dev\vb\BlogCrawl\BlogCrawlRuntime.zip
Comments
Anonymous
June 06, 2006
Hold on... i don't think the XCOPY is doing what i thought it was doing: it's actually replacing the ZIP file with the source file. Is there a programmatic way to freshen a file in Winzip, sort of like PKZIP -f option?Anonymous
June 06, 2006
The comment has been removedAnonymous
December 08, 2006
The comment has been removedAnonymous
December 09, 2006
Torrie Wilson in a thong http://torriewilson.cn.toAnonymous
December 11, 2006
Trish Stratus Unleashed http://tiny.pl/9tpxAnonymous
December 12, 2006
levaquin 500 generic http://tiny.pl/9kgnAnonymous
December 12, 2006
The comment has been removedAnonymous
December 13, 2006
side effects of topamax http://myblog.es/topamax/Anonymous
December 15, 2006
The comment has been removedAnonymous
December 16, 2006
buy ephedra http://myblog.es/ephedraAnonymous
December 17, 2006
The comment has been removedAnonymous
December 18, 2006
The comment has been removedAnonymous
May 21, 2007
f7d3djnhhkepqvdnj <a href = http://www.544516.com/112880.html > cmfe0uivkt </a> [URL=http://www.546484.com/426576.html] rn944ti0t3wn75k8 [/URL] at9clzi3awd5vhr3Anonymous
June 02, 2007
- [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL]
- Anonymous
June 02, 2007
- [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL]
- Anonymous
June 02, 2007
- [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL]
- Anonymous
June 02, 2007
- [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL]
- Anonymous
June 02, 2007
- [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL]
- Anonymous
June 03, 2007
- [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL]
- Anonymous
June 03, 2007
- [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL]
- Anonymous
June 03, 2007
- [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL]
- Anonymous
June 04, 2007
- [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL]
- Anonymous
June 04, 2007
- [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL]
- Anonymous
June 04, 2007
- [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL]
- Anonymous
June 04, 2007
- [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL]
- Anonymous
June 04, 2007
- [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL]
Anonymous
June 05, 2007
z7skqbvq9qpt <a href = http://www.205940.com/404547.html > 9h1s24vzfhbda </a> [URL=http://www.1036079.com/697025.html] ch903n9vgn0azcdq [/URL] 8re2m7g4hv75Anonymous
June 05, 2007
- [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL]
- Anonymous
June 06, 2007
- [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL]
- Anonymous
June 06, 2007
- [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL]
- Anonymous
June 07, 2007
- [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL]
- Anonymous
June 08, 2007
- [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL]
- Anonymous
June 08, 2007
- [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL]
- Anonymous
June 09, 2007
- [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL]
- Anonymous
June 09, 2007
- [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL]
- Anonymous
June 11, 2007
- [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL] - [URL= ] [/URL]
Anonymous
June 19, 2007
qijh8e3q04 http://www.226197.com/176024.html dofl3qm3wgqAnonymous
August 25, 2007
Have you noticed that you've got lots of spam in your comments system ??Anonymous
January 22, 2008
Anyway, the conditional build event is awesome. You helped me save so much time on my builds... thanks! Do you collect spam?Anonymous
June 17, 2008
This has saved me some headaches. I can't understand why it's not configuration dependant to begin with, AFAIK, it is in C++ configurations. Thanks!