Export (0) Print
Expand All

Package Class

Provides a managed implementation of the VSIP interfaces required to create a fully functional VSPackage.

This class is not CLS-compliant.  

Namespace: Microsoft.VisualStudio.Shell
Assembly: Microsoft.VisualStudio.Shell (in microsoft.visualstudio.shell.dll)

[CLSCompliantAttribute(false)] 
[ComVisibleAttribute(true)] 
public abstract class Package : IVsPackage, IServiceProvider, IOleCommandTarget, 
	IVsPersistSolutionOpts, IServiceContainer, IServiceProvider, IVsUserSettings, IVsToolWindowFactory
/** @attribute CLSCompliantAttribute(false) */ 
/** @attribute ComVisibleAttribute(true) */ 
public abstract class Package implements IVsPackage, IServiceProvider, 
	IOleCommandTarget, IVsPersistSolutionOpts, IServiceContainer, IServiceProvider, IVsUserSettings, 
	IVsToolWindowFactory
CLSCompliantAttribute(false) 
ComVisibleAttribute(true) 
public abstract class Package implements IVsPackage, IServiceProvider, 
	IOleCommandTarget, IVsPersistSolutionOpts, IServiceContainer, IServiceProvider, IVsUserSettings, 
	IVsToolWindowFactory

The Package class provides a managed implementation of several of the most useful VSIP interfaces. The implementation is compatible with the .NET Framework. A VSIP developer can create the basic functionality of a VSPackage with relatively little code by deriving from the Package class, overriding some of its methods, and attaching registration attribute classes. The Package class does not provide direct registration support, but it can use attribute classes to supply the necessary registration information to external tools such as RegPkg.exe.

The Package class offers the following services by default. (You can replace them by asking the VSPackage for IServiceContainer, removing them, and adding your own services in their place.)

  • Package

    The package offers itself as a service.

  • IServiceContainer

    Provides the ability to add and remove services. Any service added with "promote" set to true is proffered to Visual Studio through IProfferService. This makes the service global to all VSPackages within Visual Studio. (The VSIP Extras version of IServiceContainer does not support global services, so this service is only available if the VSPackage has already been loaded.)

In addition to these services, Package utilizes the service architecture of Visual Studio to provide access to any service available through the global service provider, including the entire Visual Studio SDK set of services.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Community Additions

ADD
Show:
© 2014 Microsoft