![]() |
General Programming »
Macros and Add-ins »
DevStudio Add-ins
Intermediate
ProjectZip 1.6 - Zip up the source code for your latest CodeProject articleBy .dan.g.A one-click process to building the source files in the active project into a self contained zip file, using this simple-to-use Visual Studio Add-In |
VC6Win2K, WinXP, Win2003, MFC, Dev
|
|
Advanced Search Add to IE Search |
|
|
|
||||||||||||||||


The articles I've more recently submitted to CodeProject have been related to Windows' hooking and sub-classing and have reused a number of shared components.
These shared components also typically exist in a separate folder to the article project itself.
As a result, when I come to build the zip file containing the source, I have to build in files from two or more folders and ensure that files in those folders which are not relevant, are not included.
What this means in practice, is zipping the project folder and the shared folder in their entirety and then deleting from the zip, all the shared files which are not relevant.
Clearly, the risk of human error is fairly high and I often find myself doing a number of test zips and builds until I get it right. And then if I want to update the code later, as I generally do, I've got to do it all over again.
Enter ProjectZip, a Visual Studio add-in which provides tools to zip the active project and all its files to a single zip file. And all with a single button click.
The solution, in itself, is actually quite trivial; all the significant work was in developing the appropriate wrapper classes to Gilles Volant's Multi-File API built on top of the classic ZLib code base by Jean-loup Gailly and Mark Adler.
As a result, this article is not very long or detailed, but I hope that this is more than made up for, by the usefulness of the component.
The essence of the solution is this:
IApplication object for the active project.
Then I parse the file list, iteratively building the longest path that is common to all files (what in the code I call the 'root path').
The point of establishing the root path is so that the zip file need only contain as much of a file's full path as is necessary to maintain the correct folder relationships when the zip is extracted at a later date.
Because I found the writing of the add-in so straightforward, I began looking around for other related features that might be valuable.
And then it occurred to me that apart from zipping projects to send to CodeProject, I also regularly download and unzip projects before opening them in VC6.
So why not add this facility to the addin.
Again the implementation is fairly trivial since its just a case of unzipping the file to a user-specified location and then loading the appropriate .dsw or .dsp file.
In the case of multiple .dsw files (or multiple .dsp files when no .dsw is present), I show a simple dialog that allows the user to select which project file to open.
Other features include:
To use the add-in, take the following steps:
The code is supplied here for you to use and abuse without restriction, except that you may not modify it and pass it off as your own.
General
News
Question
Answer
Joke
Rant
Admin
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 31 Mar 2004 Editor: Marc Clifton |
Copyright 2003 by .dan.g. Everything else Copyright © CodeProject, 1999-2009 Web21 | Advertise on the Code Project |