Extending the Isolated Shell
Note
This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here
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.
Note
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 Visual 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 create one that adds menu commands.
To add a new VSPackage
Add a Visual Studio Package project named
MenuCommandsPackage
.On the Basic VSPackage Information page of the wizard, set Company name to
Fabrikam
and VSPackage name toFabrikamMenuCommands
. Choose the Next button.On the next page, select Menu Command and then choose Next.
On the next page, set Command name to
Fabrikam Command
and Command ID tocmdidFabrikamCommand
, and then choose Next.On the Select Test Project Options page, clear the test options, and then choose the Finish button.
In the ShellExtensionsVSIX project, open the source.extension.vsixmanifest file.
The Assets section should contain an entry for the VSShellStub.AboutBoxPackage project.
Choose the New button.
In the Add New Asset window, in the Type list, select Microsoft.VisualStudio.VsPackage.
In the Source list, make sure that A project in the current solution is selected. In the Project list box, select MenuCommandsPackage.
Save and close the file.
Rebuild the solution and start debugging the isolated shell.
On the menu bar, choose Tools menu, then 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, under Visual C#, Extensibility, use the Editor Margin template to add a project. Name it
ShellEditorMargin
.In the ShellExtensionsVSIX project, open the Source.extension.vsixmanifest file in the Design view, not the Code view.
In the
Asset
section, choose Add Content.In the Add New Asset window, in the Type list, select Microsoft.VisualStudio.MefComponent.
In the Source list, make sure that A project in the current solution is selected. In the Project 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, under Visual C#, Extensibility, use the VSIXProject template to add a project. Name it
EmptyVSIX
.In the ShellExtensionsVSIX project, open the Source.extensions.vsixmanifest file in the Design view, not the Code view.
In the
Assets
section, choose New.In the Add New Asset window, in the Type list, select the kind of content you want to add.
In Source, make sure that the A project in current solution option is 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 so that the assembly is included in the output.
Unload the VSIX project and open the project file.
In the first
<PropertyGroup>
block, change the value of<CopyBuildOutputToOutputDirectory>
totrue
.Save and reload the project.
Build and run the solution.