Extending the Isolated Shell
You can extend the Visual Studio isolated shell by adding a VSPackage, a Managed Extensibility Framework (MEF) component part, or a generic VSIX project to your isolated shell application.
Nota
The following steps presuppose that you have created a basic isolated shell application by using the Visual Studio Shell Isolated project template. For more information about this project template, see Walkthrough: Creating a Basic Isolated Shell Application.
Locations for the Visual Studio Package Project Template
The Visual Studio Package project template can be found in three different locations in the New Project dialog:
Under Visual Basic Extensibility. The default language of the project is Visual Basic.
Under C# Extensibility. The default language of the project is C#.
Under Other Project Types Extensibility. The default language of the project is C++.
Adding a VSPackage
You can add a VSPackage to your isolated shell application. The following steps show how to add a new VSPackage that adds menu commands.
To add a new VSPackage
Create a Visual Studio Package project and name the project MenuCommandsPackage.
On the first page of the Visual Studio Package template, click Next. On the next page, select Visual C# and then click Next.
On the Basic VSPackage Information page, set Company name to Fabrikam and VSPackage name to FabrikamMenuCommands, and then click Next.
On the next page, select Menu Command and then click Next.
On the next page, set Command name to Fabrikam Command, and Command ID to cmdid FabrikamCommand, and then click Next.
On the Select Test Project Options page, clear the test options, and then click Finish.
The template creates a project named MenuCommandsPackage, which appears in Solution Explorer.
In the ShellExtensionsVSIX project, open the Source.extension.vsixmanifest file. Edit this file in the Design view, not the Code view.
The Content section should contain one entry for the VSShellStub.AboutBoxPackage project.
Click Add Content.
In the Add Content window, in the Select a content type list, select VS Package.
In Select a source, Project should be selected. In the list box, select MenuCommandsPackage.
Save and close the file.
Rebuild the solution and start debugging the isolated shell.
On the Tools menu, click Fabrikam Command.
A message box should appear.
Stop debugging the application.
Adding a MEF Component Part
The following steps show how to add a MEF component part to your isolated shell application.
To add a MEF component
In the Add New Project dialog box, select Visual C# and then select Extensibility. Select the Editor Margin project template. Name the project ShellEditorMargin.
In the ShellExtensionsVSIX project, open the Source.extension.vsixmanifest file. Edit this file in the Design view, not the Code view.
In the Content section, click Add Content.
In the Add Content window, in the Select a content type list, select MEF Component.
In Select a source, the Project option should be selected. In the list box, select ShellEditorMargin.
Save and close the file.
Rebuild the solution and start debugging the isolated shell.
Open a text file.
A green margin that contains the words "Hello world!" should be displayed at the bottom of the text file window.
Stop debugging the application.
Adding a Generic VSIX Project
To add a generic VSIX project
In the Add New Project dialog box, select Visual C# and then select Extensibility. Select the VSIXProject project template. Name the project EmptyVSIX.
In the ShellExtensionsVSIX project, open the Source.extensions.vsixmanifest file. Edit this file in the Design view, not the Code view.
In the Content section, click Add Content.
In the Add Content window, in the Select a content type list, select the kind of content you want to add.
In Select a source, the Project option should be selected. In the list box, select the name of your VSIX project.
Save and close the file.
If this project includes compiled code, you must edit the project to include the assembly in the output.
Unload the VSIX project and open the project file for editing.
In the first <PropertyGroup> block, change the value of <CopyBuildOutputToOutputDirectory> to true.
Save and reload the project.
Build and run the solution.