I should like to extend my sincere thanks to all those for mailing me reminders about the .NET port of ProjectZip which I had 'promised' to write following the initial interest in the VC6 addin.
I had hoped the issue would quietly go away as my early forays into .NET addin-writing did not fill me with enthusiasm. Additionally there was the problem of .NET 2002 addins not being compatible with .NET 2003 which left me feeling that a .NET port was a can of worms that I really did not want to open, let alone plunge my hands into!
Nevertheless, a promise is a promise, and I'm fairly honourable if nothing else, so I vigorously thought of alternatives that might satisfy the .NET community without requiring an actual .NET port.
There was also some unfinished work relating to being able to zip entire workspaces and not just the active project that prompted me to get on and finish the job, which I think I now have (more or less).
The result is a '3-in-1' solution - three tools with the same core functionality - providing a multiplicity of ways to zip a workspace or project file for Visual Studio 6 and all versions of Visual Studio .NET.
The way I've re-architected the core functionality should also allow it to be extended to support project files from other development environments such as Borland C++, Delphi and Visual Basic.
1. ProjectZip Executable (New)
This is one of two solutions for .NET users, although it can also be run directly from explorer, or more likely from the Quick-Start-Bar (or whatever it's called).
Apart from a filename on the commandline, the executable also accepts the following parameters:
- /q - quick zip using the current options
- /o - show the options dialog only
- /u - unzip a workspace or project from a .zip file
The filename can have the one of following extensions when zipping:
and .zip when unzipping.
If you pass no parameters except a filename then the assumption is that you want to zip the file.
If an inappropriate file is passed on the commandline then you will just get the options dialog
And finally, if you run the executable with no commandline (i.e. from explorer) then you will be prompted to browse for the file you want to zip.
2. ProjectZip Shell Extension (New)
This is the second solution for .NET users, although it may also become the prefered option for VC6 users since it does not require VC6 to be run.
To install all you have to do is:
- Copy ProjectZipShExt.dll to your folder of choice
- Close all explorer windows
- Register it as follows:
Then whenever you right-click on a VC6/7 workspace or project file in explorer you will have the option to zip that file.
Note: at present you always get the options dialog because I wanted to limit the number of menu items that get added to the explorer context menu.
ProjectZip Addin for VC6 (Updated)
This has been substantially re-written to support the re-architected core functionality and now sports 5 buttons instead of the original 3. The two extra buttons allow the zipping of entire workspaces rather than just the active project.
The two forms - Workspace and Project - are denoted by 'W' and 'P' on the buttons.
I've also removed the restriction on having to have a workspace or project open to use the addin. Instead, if the current Workspace or Project cannot be determined, you will be prompted to browse to the file you want.
To install and use the addin:
- Close VC6 if its is open.
- Copy ProjectZip6Addin.dll to "..\Microsoft Visual Studio\Common\MSDev98\AddIns"
- Restart VC6
- Select the 'Add-ins and Macro Files' tab from the 'Tools|Customize' dialog box.
- Select the checkbox next to the the 'ProjectZip6Addin' entry.
- When you close the dialog the ProjectZip toolbar should appear which you can drag and drop onto the VC6 main window.
Note: Apologies to existing users for renaming the addin but with 3 projects all providing similar services I had to differentiate between them.
Restructuring the Code
The following diagram (drawn with CodePlotter © AbstractSpoon 2003) shows the architecture of the core functionality of the ProjectZip toolset.
: ProjectZip Core Functionality Architecture
|overides virtual m|
|ethods to provide |
|parsing of the dsp|
| and dsw files |
|IProjectZip >---->CProjectZipBase >------>------------------.
|_____________| |___________________| |CProjectZip7 |
| | | | |__________________|
|pure virtual | |contains generic zi| | |
| interface | |p code with key met| |overides virtual m|
·-------------· |hods declared as pu| |ethods to provide |
|re virtual to handl| |parsing of the vcp|
|e different file fo| |roj and sln files |
|rmats | ·------------------·
|Other Formats... |
This architecture affords me a number of benefits:
- New workspace/project file formats can be added by simply deriving from CProjectZipBase and implementing 3 pure virtual functions, two of which are one-liners.
- CProjectZipBase (accounting for 95% of the code) knows nothing about specific file formats which protects it from file format tinkering.
- The tools described earlier need only interface with IProjectZip, further protecting them from internal changes to CProjectZipBase and its derived classes.
If you don't use Visual Studio and would like to develop parsers for the particular development system you do use then I would be happy to answer any questions you may have and provide guidance on what would need to be done.
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.
- 1.6 (2 Apr 2004)
- option added to allow zipping of 'non-essential' project files such as .clw, .ncb, .opt, .suo
- various bugs fixed relating to using the correct user preferences
- filter index is now saved after browsing for a file to zip (affects executable only)
- 1.5.2 (9 Mar 2004)
- code added to handle project file paths of the form ('\file.cpp') which are files in the root of the drive containing the proejct file (thanks to gjr)
- registry code fixed where direct registry access was failing (thanks to Peter Boulton)
- 1.5.1 (5 Mar 2004)
- small adjustment to .NET project file parsing to make it more robust
- 1.5 (4 Mar 2004)
- restructured to allow for multiple project file extensions (important for .NET workspaces)
- support added for .NET2003 project files (microsoft subtlely changed the format)
- 1.4 (3 Mar 2004)
- option added to set zip filename to lowercase
- zip paths saved and restored to/from registry (keyed by workspace path)