Jason Zander is Corporate Vice President of Development for the Windows Azure team at Microsoft.
Learn more about Jason.
More videos »
The SDK is used to create extensions to Visual Studio itself like those you can find on VS Gallery. You can download it here. The installation is done on top of an existing install of VS 2010 and gives you a set of build tools, templates, and a short cut for debugging devenv.exe (VS) that can be used for testing your new extensions.
Once you get the SDK installed, you will find a new set of templates. Let’s start by doing File, New Project. Type ‘editor’ in the search box to find example editor extensions:
Select the ‘Editor Text Adornment’ template and click OK. This sample template extends the editor with a Text Adornment which basically gives you the ability to change how text is displayed. By default this adornment finds all instances of the character ‘a’ and highlights them.
Build the solution (Ctrl+Shift+B). The template automatically packages the new .dll into a .vsix file (basically a zip with some dialogs, the code, and other data required to extend VS). It then copies the new package into the Extensions directory for the test instance of VS:
Now hit F5 to debug the new extension. Because you are extending Visual Studio itself, the test instance of VS is launched:
This is a separate instance of devenv.exe as shown by tlist:
Notice the key difference is devenv.exe is launched with a special /rootsuffix flag which gives it a different instance for the extension location:
In the experimental instance of VS, open a text file (such as the one generated for this add-in). When it loads, you’ll notice the editor extension is in effect and has drawn a red box around every ‘a’ in the file:
The code is pretty straightforward. The constructor sets up a event handler for layout changed, whenever the change happens every line is scanned, within each line when an ‘a’ is found a red box is placed around it.
If you open the .vsixmanifest file you will get an editor for all the settings an extension needs:
This includes things like the images you will see when you browse / install the extension, the description, etc.
Extensions can be easily shared with your friends. To install an extension, either double click the VSIX file to install it or copy the unzipped extension contents to your extensions directory.
In addition to local usage, you can also publish (or acquire) extensions from the VS Gallery. This is easy to do from inside VS by choosing Tools, Extension Manager:
If you select the Online Gallery, you will find all the controls, templates, and tools from the public site:
You can easily download and install an extension by selecting it and hitting the Download button. In this case I’ll download the Demo Dashboard which is one of our samples:
After you download the file (assuming you accept the license), you will be prompted to restart VS so the extension can be loaded:
If you select Restart Now, VS will start again and restore your state. The new extension is now in place:
Once you have written an extension you really like and you think others may want, you can use the VS Gallery site to upload your item:
You can update, delete, etc your extension after it is uploaded.
As you can see, loading new items, creating new items, etc is very straightforward. I’m looking forward to seeing what you come up with.