ProvideObjectAttribute Class
Informs Visual Studio that the VSPackage provides an object that can be created from the ILocalRegistry interface. This class cannot be inherited.
Assembly: Microsoft.VisualStudio.Shell.14.0 (in Microsoft.VisualStudio.Shell.14.0.dll)
System.Attribute
Microsoft.VisualStudio.Shell.RegistrationAttribute
Microsoft.VisualStudio.Shell.ProvideObjectAttribute
| Name | Description | |
|---|---|---|
![]() | ProvideObjectAttribute(Type) | This constructor creates a new ProvideObjectAttribute object with the given object type. |
| Name | Description | |
|---|---|---|
![]() | ObjectType | The ObjectType property returns the object type set in the constructor. |
![]() | RegisterUsing | Gets or sets the registration method. |
![]() | TypeId | Gets the current instance of this attribute.(Inherited from RegistrationAttribute.) |
| Name | Description | |
|---|---|---|
![]() | Equals(Object) | (Inherited from Attribute.) |
![]() | GetHashCode() | (Inherited from Attribute.) |
![]() | GetType() | (Inherited from Object.) |
![]() | IsDefaultAttribute() | (Inherited from Attribute.) |
![]() | Match(Object) | (Inherited from Attribute.) |
![]() | Register(RegistrationAttribute.RegistrationContext) | Provides registration information about a VSPackage when called by an external registration tool such as regpkg.exe. For more information, see Registering VSPackages.(Overrides RegistrationAttribute.Register(RegistrationAttribute.RegistrationContext).) |
![]() | ToString() | (Inherited from Object.) |
![]() | Unregister(RegistrationAttribute.RegistrationContext) | Removes registration information about a VSPackage when called by an external registration tool such as regpkg.exe. For more information, see Registering VSPackages.(Overrides RegistrationAttribute.Unregister(RegistrationAttribute.RegistrationContext).) |
| Name | Description | |
|---|---|---|
![]() ![]() | _Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) | (Inherited from Attribute.) |
![]() ![]() | _Attribute.GetTypeInfo(UInt32, UInt32, IntPtr) | (Inherited from Attribute.) |
![]() ![]() | _Attribute.GetTypeInfoCount(UInt32) | (Inherited from Attribute.) |
![]() ![]() | _Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) | (Inherited from Attribute.) |
Apply the ProvideObjectAttribute attribute to your Microsoft.VisualStudio.Package-derived class if it provides an object that can be created from the ILocalRegistry interface.
The ProvideObjectAttribute class informs Visual Studio that it provides an object that can be created from the ILocalRegistry interface. Always use this attribute rather than registering objects globally under the HKEY_CLASSES_ROOT\CLSID section of the registry. Use the ProvideObjectAttribute, to modify a Microsoft.VisualStudio.Package-derived class, or a class that implements IVsPackage.
This attribute class is only used to provide data for external registration tools like regpkg.exe. It does not have any effect on the run-time behavior of the VSPackage. For more information, see Registering VSPackages.
Note |
|---|
C# automatically appends the word "Attribute" to the name of any attribute class. In C# code, refer to this attribute as ProvideObject. |
The following registry entries are created by the ProvideObjectAttribute class:
<VSROOT>\CLSID\{ObjectGuid}
<VSROOT>\CLSID\{ObjectGuid}\@=ObjectType.FullName
<VSROOT>\CLSID\{ObjectGuid}\InprocServer32=mscoree.dll
<VSROOT>\CLSID\{ObjectGuid}\Class=ObjectType.FullName
<VSROOT>\CLSID\{ObjectGuid}\Assembly=ObjectType.Assembly.FullName
<VSROOT>\CLSID\{ObjectGuid}\ThreadingModel=Both
<VSROOT>\CLSID\{PackageGuid}\CodeBase=context.CodeBase
You can find implementations of the ProvideObjectAttribute class in the managed samples. The standard location for this and all other attributes used for automatic registration is adjacent to the implementation of the Microsoft.VisualStudio.Package class in VsPkg.cs, VsPkg.vb, or VsPkg.cpp, depending on the language used in the sample.
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.




