Share via


How to: Register a Tool Window

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

'UICONTEXT_SolutionExists 

<MsVsShell.ProvideToolWindow(GetType(PersistedWindowPane), Style := MsVsShell.VsDockStyle.Tabbed, Window := "3ae79031-e1bc-11d0-8f78-00a0c9110057")> _ 
<MsVsShell.ProvideToolWindow(GetType(DynamicWindowPane), PositionX := 250, PositionY := 250, Width := 160, Height := 180, Transient := True)> _ 
<MsVsShell.ProvideToolWindowVisibility(GetType(DynamicWindowPane), "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 
    Inherits MsVsShell.Package 
End Class
[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 Solution Explorer, and the dynamic window is given a default starting position and size. The dynamic window is made transient, which indicates 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.

See Also

Concepts

VSPackage Essentials