Share via


RegistrationAttribute.RegistrationContext Class

An abstract base class that provides context information from an external source to a registration attribute.

Inheritance Hierarchy

System.Object
  Microsoft.VisualStudio.Shell.RegistrationAttribute.RegistrationContext

Namespace:  Microsoft.VisualStudio.Shell
Assembly:  Microsoft.VisualStudio.Shell.Immutable.10.0 (in Microsoft.VisualStudio.Shell.Immutable.10.0.dll)

Syntax

'Declaration
Public MustInherit Class RegistrationContext
public abstract class RegistrationContext
public ref class RegistrationContext abstract
[<AbstractClass>]
type RegistrationContext =  class end
public abstract class RegistrationContext

The RegistrationAttribute.RegistrationContext type exposes the following members.

Constructors

  Name Description
Protected method RegistrationAttribute.RegistrationContext Creates a new RegistrationAttribute.RegistrationContext.

Top

Properties

  Name Description
Public property CodeBase Gets the path and filename of the object being registered.
Public property ComponentPath Gets the path to the component that is being registered.
Public property ComponentType Gets the type of component being registered.
Public property InprocServerPath Gets the path to the in-process server DLL.
Public property Log Gets a TextWriter object that can be used to log events during registration.
Public property RegistrationMethod Gets a value that specifies how the assembly should be located (CodeBase or Assembly).
Public property RootFolder Gets or sets the root folder.

Top

Methods

  Name Description
Public method CreateKey Creates a new registration key by name.
Public method Equals Determines whether the specified object is equal to the current object. (Inherited from Object.)
Public method EscapePath Reformats a string as needed by the registration tool.
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method RemoveKey Removes an existing registration key.
Public method RemoveKeyIfEmpty Removes the key of the specified name if it has no child key and no value.
Public method RemoveValue Removes a value from a registration key.
Public method ToString Returns a string that represents the current object. (Inherited from Object.)

Top

Remarks

When to Implement

Registration tools (such as CreatePkgDef.exe) that use the information provided by the registration attribute classes must implement this class, RegistrationAttribute.RegistrationContext, as well as RegistrationAttribute.Key.

Basic Usage

A RegistrationAttribute.RegistrationContext object is created by a registration utility such as CreatePkgDef or the Windows Installer to provide information to a registration attribute. The registration context includes the type of object that is being registered, the object's path, and helper properties. It is also used to create keys that can be used to write registration information.

When the registration utility registers a managed package assembly, it uses reflection to search the assembly for attribute classes that implement the RegistrationAttribute class. A RegistrationAttribute.Key object is placed into the RegistrationAttribute.RegistrationContext object and passed to the Register (or Unregister) method of the attribute class.

The attribute class uses the information in the RegistrationAttribute.Key and RegistrationAttribute.RegistrationContext objects to actually carry out the registration tasks required by the attribute.

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

RegistrationAttribute

RegistrationAttribute.RegistrationContext

Other Resources

Managed Package Registration

Registering VSPackages