Right now, I'm working for a client out in San Francisco -- yup, left my heart in SF. Anyhow, this client, after providing them the install package consisting of .NET 2.0 Framework, Crystal Reports, the build's EXE & DLL(s), any third-party DLLs, etc...
Well, there's always enhancements and bug fixes that needs to be done. Why should I send my client a HUGE install package that they would have to go uninstall/install on a daily basis? Why not just quickly overwrite their existing EXEs and DLLs? Usually, I include a SQL Script, Word doc with notes, and the EXE/DLLs. That wasn't a problem if I have only one exe, but as the project grew, we now have a total of 7 DLLs.
I was looking for a solution to package the entire build of the project into one folder and automatically zip them all up and then I'll just attach the zip file to my daily emails to my client. See, I'm lazy.
Came across Visual Studio 2005 post-build event command dialog. If you have VS 2005, go to the solution's StartUp project, right-click, Properties, Build Events -- you'll see there's a textbox under the "Post-build event command line:" -- this'll be where you can type out the path to your .bat file.
Perfect...step one out of the way. Using a .bat file that I can have executed after Visual Studio completes the build, I can move files from my bin/Debug (or bin/Release) folder over to a My Document folder that I set up for the client. Easy 'nuf. However, I don't want to move files around every day -- human error can creep in. See, I'm still lazy.
Besides, most email programs balk at sending/receiving EXEs and DLLs, especially Outlook, therefore I cannot send it as is. I would need to compress them into a zip file. I cannot imagine doing that manual work EVERY single day, perhaps twice a day. Now, let's look for a zip program that you can run off using the command-line or a .bat file. Amazingly Windows XP doesn't have a built-in command-line zip program, you have to use the UI to unzip/zip the files.
Lo and behold! I found a solution: 7-zip -- http://www.7-zip.org/ -- downloaded and installed it. Pretty much self-explanatory.
Now, the tough part -- piecing them all together.
Let's create a new plain ol' text file via Notepad consisting of all the files you want zipped.
8 lines in that text file. Saved it as BuildFiles.txt, and put it in my bin/Debug folder. Next, let's create the .bat file zipping all those EXE and DLLs into one neat and tidy package.
Let's see... created a file aptly named zip-em.bat, and also put it in the bin/Debug folder:
"C:\Program Files\7-Zip\7z" u -tzip "C:\Documents and Settings\rob\My Documents\Clients\Program1\6.0\ProgramZipped.zip" @"C:\Documents and Settings\rob\My Documents\Visual Studio 2005\Projects\Program1\Program1\bin\Debug\BuildFiles.txt"
All in one line, quoted, and see the end of that command line -- the know-it-all BuildFiles.txt.
Now... it'll run the zip-em.bat file AFTER the project compiles and builds all those EXE & DLLs. Here's the text that's from the screenshot:
call "C:\Documents and Settings\rob\My Documents\Visual Studio 2005\Projects\Program1\Program1\bin\Debug\zip-em.bat
See! Easier said than done, or was it perhaps the other way around? :-) If you got a way to increase my productivity or ways of making me more lazy, please add a comment.