ProvideObjectAttribute Class

 

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

Namespace:   Microsoft.VisualStudio.Shell
Assembly:  Microsoft.VisualStudio.Shell.14.0 (in Microsoft.VisualStudio.Shell.14.0.dll)

System.Object
  System.Attribute
    Microsoft.VisualStudio.Shell.RegistrationAttribute
      Microsoft.VisualStudio.Shell.ProvideObjectAttribute

[AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple = true, 
	Inherited = true)]
public sealed class ProvideObjectAttribute : RegistrationAttribute

NameDescription
System_CAPS_pubmethodProvideObjectAttribute(Type)

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

NameDescription
System_CAPS_pubpropertyObjectType

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

System_CAPS_pubpropertyRegisterUsing

Gets or sets the registration method.

System_CAPS_pubpropertyTypeId

Gets the current instance of this attribute.(Inherited from RegistrationAttribute.)

NameDescription
System_CAPS_pubmethodEquals(Object)

(Inherited from Attribute.)

System_CAPS_pubmethodGetHashCode()

(Inherited from Attribute.)

System_CAPS_pubmethodGetType()

(Inherited from Object.)

System_CAPS_pubmethodIsDefaultAttribute()

(Inherited from Attribute.)

System_CAPS_pubmethodMatch(Object)

(Inherited from Attribute.)

System_CAPS_pubmethodRegister(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).)

System_CAPS_pubmethodToString()

(Inherited from Object.)

System_CAPS_pubmethodUnregister(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).)

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.

System_CAPS_noteNote

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.

Return to top
Show: