Partager via


RegistrationAttribute.RegistrationContext Class

Definition

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

public: ref class RegistrationAttribute::RegistrationContext abstract
[Windows::Foundation::Metadata::WebHostHidden]
class RegistrationAttribute::RegistrationContext abstract
public abstract class RegistrationAttribute.RegistrationContext
type RegistrationAttribute.RegistrationContext = class
Public MustInherit Class RegistrationAttribute.RegistrationContext
Inheritance
RegistrationAttribute.RegistrationContext
Derived

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.

Constructors

RegistrationAttribute.RegistrationContext()

Creates a new RegistrationAttribute.RegistrationContext.

Properties

CodeBase

Gets the path and filename of the object being registered.

ComponentPath

Gets the path to the component that is being registered.

ComponentType

Gets the type of component being registered.

InprocServerPath

Gets the path to the in-process server DLL.

Log

Gets a TextWriter object that can be used to log events during registration.

RegistrationMethod

Gets a value that specifies how the assembly should be located (CodeBase or Assembly).

RootFolder

Gets or sets the root folder.

Methods

CreateKey(String)

Creates a new registration key by name.

EscapePath(String)

Reformats a string as needed by the registration tool.

RemoveKey(String)

Removes an existing registration key.

RemoveKeyIfEmpty(String)

Removes the key of the specified name if it has no child key and no value.

RemoveValue(String, String)

Removes a value from a registration key.

Extension Methods

EscapeAssemblyRelativePath(RegistrationAttribute+RegistrationContext, String)

Returns an escaped string representing the full path of the specified folder relative to the assembly of the component being registered

GetAssemblyLocation(RegistrationAttribute+RegistrationContext)

Returns the parent folder containing the assembly of the component being registered

Applies to