Dragging and dropping files and folders into .vsix

Visual Studio Extensions, or VSIX files are simple ZIP archives following the Open Package Conventions, and have a .vsix extension. Double-clicking on a .vsix will install it into Visual Studio, by opening it with VSIXInstaller.exe.

TL;DR: IF you want to be able to drag files and folders into .vsix, there’s a registry tweak you can apply – add Windows Compressed (zipped) Folders  drop handler’s GUID to the .vsix entry under HKCR.vsix. Create the subkeys shellext\DropHandler:

HKEY_CLASSES_ROOT\.vsix\shellex\DropHandler

Set the value of (Default) inside DropHandler to {ED9D80B9-D157-457B-9192-0E7280313BF0}, restart explorer.exe, and voilla! You can now drag files or folders into .vsix files, as if they were named .zip.

// output:verbose

I wanted to drag some files into the VSIX package, but it didn’t work – Windows has no idea that a .vsix is actually a .zip file:

Dragging files and folders onto other files or folders is handled by Shell Drop Handlers (and writing one in .NET is made incredibly simple by using SharpShell by Dave Kerr). Instead of writing one for .vsix, I wanted to make the default one, the one that handles zip files (known as Compressed Folders in Windows), treat .vsix as .zip archives. For this, I needed to assign zip’s Drop Handler to .vsix. Since Drop Handlers are Shell Extensions based on COM, it must mean they have a GUID. And to list all Shell Extension GUIDs, we can use a nice little utility by NirSoft called ShellExView.

Upon running ShellExView, we’ll get a listing of all the Shell Extensions installed on our system. We know Windows has one for zipped files, pressing Ctrl-F and searching for ˜zip’ takes us to to the *Compressed (zipped) Folder DropHandler. We need the GUID for this handler, so double-clicking on the entry opens its Properties pane, where we can copy the GUID entry.

Last step is adding this GUID as a valid Drop Handler for .vsix files. Steps to do this are described in the TL;DR above.

After restarting explorer.exe (or rebooting), we can now drag and drop files onto .vsix files!

Happy hacking!