Select Page

One of the community submitted feature requests was for keyboard shortcuts for the CKSDev menu items. Tobias Zimmergren raised a good suggestion that rather than use the established WSPBuilder versions it would be preferable to use a new set. This makes perfect sense as we always aim for CKSDev to play nice with other extensions.

The job was made easier as Carsten is part of the CKSDev team as well as the author of WSPBuilder so he was able to point me in the direction of the existing WSPBuilder shortcuts.

The WSPBuilder shortcuts are:

Ctrl+Shift+Alt+B, B >> Build WSP
Ctrl+Shift+Alt+B, D >> Deploy WSP
Ctrl+Shift+Alt+B, P >> Upgrade WSP
Ctrl+Shift+Alt+B, U >> Uninstall WSP
———————————————-
Ctrl+Shift+Alt+B, C >> Copy to Root
Ctrl+Shift+Alt+B, G >> Copy to GAC
———————————————-
Ctrl+Shift+Alt+B, R >> Recycle AppPools
Ctrl+Shift+Alt+B, T >> Restart Timer Service
Ctrl+Shift+Alt+B, F >> Create Deployment Folder
Ctrl+Shift+Alt+B, A >> Attach to IIS Worker Processes

Wictor Wilén suggested some alternative shortcuts which are:

Ctrl+Shift+Alt+C
Copy to SharePoint Root: +C
Copy to GAC\Bin: +G
Copy Both: +B
———————————————-
And Ctrl+Shift+Alt+R
Recycle Project AppPool; +R
Recycle all AppPools: +A
Restart IIS: + I
Restart User Code process: +U
Restart Timer process: +T
———————————————-
And for these use Ctrl+Shift+Alt+A
Attach to All SharePoint processes: +S
Attach to IIS Worker processes: +I
Attach to User Code process: +U
Attach to Timer process +T
Attach to VSSHost4 process: +V

Armed with the proposed shortcuts I set out to implement them into the codebase. The VSPackage infrastructure provides a declarative method to define shortcuts. The ‘vsct’ file is where the magic happens. What you have to add are the KeyBinding elements with the relevant information. The KeyBinding element defines the command to associate the keys too, the editor type (The value for the default Visual Studio editor is “guidVSStd97”) and the keys combined to form the shortcut. The image below gives a couple of examples for the ‘Attach to processes’ commands.

image

The commands are already implemented and registered in the ‘EventHandlerManager’ class. The key bindings will invoke the same logic as the menu item clicks. There is also a really good blog post by DotNeteers which provides lots of walkthrough information about the VSPackage vsct file and the capabilities within it.

Due to the fact there are several commands which appear on different menu structures I had to introduce some kind of consistent second key stroke mapping:

So the way it’ll map is

  • Solution > Shift
  • Selection > Ctrl
  • Context > Just the letter
  • File > Shift Ctrl
  • Folder > Shift Ctrl Alt

These new shortcuts will be available with the release of version 1.2 which is available soon.