Package Class
Provides a managed implementation of the VSIP interfaces required to create a fully functional VSPackage.
This API is not CLS-compliant.
Namespace: Microsoft.VisualStudio.Shell
Assemblies: Microsoft.VisualStudio.Shell.9.0 (in Microsoft.VisualStudio.Shell.9.0.dll)
Microsoft.VisualStudio.Shell (in Microsoft.VisualStudio.Shell.dll)
Microsoft.VisualStudio.Shell.10.0 (in Microsoft.VisualStudio.Shell.10.0.dll)
Syntax
'Dichiarazione
<PackageRegistrationAttribute> _
<CLSCompliantAttribute(False)> _
<ComVisibleAttribute(True)> _
Public MustInherit Class Package _
Implements IVsPackage, IServiceProvider, IOleCommandTarget, IVsPersistSolutionOpts, _
IServiceContainer, IServiceProvider, IVsUserSettings, IVsUserSettingsMigration, IVsToolWindowFactory
'Utilizzo
Dim instance As Package
[PackageRegistrationAttribute]
[CLSCompliantAttribute(false)]
[ComVisibleAttribute(true)]
public abstract class Package : IVsPackage,
IServiceProvider, IOleCommandTarget, IVsPersistSolutionOpts, IServiceContainer, IServiceProvider,
IVsUserSettings, IVsUserSettingsMigration, IVsToolWindowFactory
[PackageRegistrationAttribute]
[CLSCompliantAttribute(false)]
[ComVisibleAttribute(true)]
public ref class Package abstract : IVsPackage,
IServiceProvider, IOleCommandTarget, IVsPersistSolutionOpts, IServiceContainer, IServiceProvider,
IVsUserSettings, IVsUserSettingsMigration, IVsToolWindowFactory
[<AbstractClassAttribute>]
[<PackageRegistrationAttribute>]
[<CLSCompliantAttribute(false)>]
[<ComVisibleAttribute(true)>]
type Package =
class
interface IVsPackage
interface IServiceProvider
interface IOleCommandTarget
interface IVsPersistSolutionOpts
interface IServiceContainer
interface IServiceProvider
interface IVsUserSettings
interface IVsUserSettingsMigration
interface IVsToolWindowFactory
end
public abstract class Package implements IVsPackage, IServiceProvider, IOleCommandTarget, IVsPersistSolutionOpts, IServiceContainer, IServiceProvider, IVsUserSettings, IVsUserSettingsMigration, IVsToolWindowFactory
Remarks
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.
-
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 uses 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.
Inheritance Hierarchy
System.Object
Microsoft.VisualStudio.Shell.Package
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
See Also
Reference
Microsoft.VisualStudio.Shell Namespace