|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.|
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
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, removing them, and adding your own services in their place.)
The package offers itself as a service.
Provides the ability to add and remove services. Any service added with "promote" set to true is proffered to Visual Studio through. 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.