This documentation is archived and is not being maintained.

How to: Register a Tool Window (C#)

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

The managed package framework (MPF) provides attributes to control the registration of managed tool windows. The RegPkg utility uses these attributes to register a tool window with Visual Studio.

Example

The code that follows is from the Reference.ToolWindow Sample (C#).

 
[MsVsShell.ProvideToolWindow(typeof(PersistedWindowPane), Style = MsVsShell.VsDockStyle.Tabbed, Window = "3ae79031-e1bc-11d0-8f78-00a0c9110057")]
[MsVsShell.ProvideToolWindow(typeof(DynamicWindowPane), PositionX=250, PositionY=250, Width=160, Height=180, Transient=true)]
[MsVsShell.ProvideToolWindowVisibility(typeof(DynamicWindowPane), /*UICONTEXT_SolutionExists*/"f1536ef8-92ec-443c-9ed7-fdadf150da82")]

[MsVsShell.ProvideMenuResource(1000, 1)]
[MsVsShell.DefaultRegistryRoot(@"Software\Microsoft\VisualStudio\8.0Exp")]
[MsVsShell.PackageRegistration(UseManagedResourcesOnly = true)]
[Guid("01069CDD-95CE-4620-AC21-DDFF6C57F012")]
public class PackageToolWindow : MsVsShell.Package
{

The ProvideToolWindowAttribute registers the PersistedWindowPane and DynamicWindowPane tool windows with Visual Studio. The persisted tool window is docked and tabbed with the Solution Explorer (3ae79031-e1bc-11d0-8f78-00a0c9110057) and the dynamic window is given a default starting position and size. The dynamic window is made transient, indicating that it is not created on Visual Studio startup. This writes a DontForceCreate value in the ToolWindows key in the system registry. For more information, see Tool Window Display Configuration.

The ProvideMenuResourceAttribute determines the menu resource ID (1000) and version number (1). For more information about DefaultRegistryRootAttribute and PackageRegistrationAttribute, see How to: Register a VSPackage (C#).

See Also

Show: