ProvideObjectAttribute Class

Definition

Informs Visual Studio that the VSPackage provides an object that can be created from the ILocalRegistryinterface. This class cannot be inherited.

public ref class ProvideObjectAttribute sealed : Microsoft::VisualStudio::Shell::RegistrationAttribute
public ref class ProvideObjectAttribute sealed : Microsoft::VisualStudio::Shell::RegistrationAttribute
[System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=true, Inherited=true)]
public sealed class ProvideObjectAttribute : Microsoft.VisualStudio.Shell.RegistrationAttribute
[<System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=true, Inherited=true)>]
type ProvideObjectAttribute = class
    inherit RegistrationAttribute
Public NotInheritable Class ProvideObjectAttribute
Inherits RegistrationAttribute
Inheritance
ProvideObjectAttribute
Attributes

Examples

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.

Remarks

When to Call

Apply the ProvideObjectAttribute attribute to your Microsoft.VisualStudio.Package-derived class if it provides an object that can be created from the ILocalRegistryinterface.

Basic Usage

The ProvideObjectAttribute class informs Visual Studio that it provides an object that can be created from the ILocalRegistryinterface. 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.

Registry Entries

  • 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

Constructors

ProvideObjectAttribute(Type)

This constructor creates a new ProvideObjectAttribute object with the given object type.

Properties

ObjectType

The ObjectType property returns the object type set in the constructor.

RegisterUsing

Select between specifying the Codebase entry or the Assembly entry in the registry. This can be overriden during registration

TypeId

Gets the current instance of this attribute.

(Inherited from RegistrationAttribute)

Methods

GetPackageRegKeyPath(Guid)

Gets the registry path (relative to the registry root of the application) of the VSPackage.

(Inherited from RegistrationAttribute)
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.

Unregister(RegistrationAttribute+RegistrationContext)

Unregisters this attribute.

Applies to