语言

RegistrationAttribute 类

定义

VSPackage 注册的抽象类。 RegistrationAttribute 类允许添加新的注册信息,而无需更改注册工具。

public ref class RegistrationAttribute abstract : Attribute
[System.AttributeUsage(System.AttributeTargets.Class)]
[System.CLSCompliant(true)]
public abstract class RegistrationAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Class)]
public abstract class RegistrationAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class)>]
[<System.CLSCompliant(true)>]
type RegistrationAttribute = class
    inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Class)>]
type RegistrationAttribute = class
    inherit Attribute
Public MustInherit Class RegistrationAttribute
Inherits Attribute
继承
RegistrationAttribute
派生
属性

注解

何时实现

从 RegistrationAttribute 派生注册属性,以创建一个类,该类在应用于 Package派生类或实现 的类时创建专用注册表项 IVsPackage。

基本用法

提供 VSPackage 注册信息的属性类。 Regpkg.exe 或其他注册工具必须派生自 并实现 RegistrationAttribute。 有关详细信息,请参阅注册 VSPackage。

RegistrationAttribute 是一个抽象属性类,使 VSPackage 开发人员无需更改注册工具即可添加注册属性类。

向 regpkg.exe 或其他注册工具提供注册信息的属性类必须派生自 RegistrationAttribute,并且必须实现 Register 和 Unregister 抽象方法。

regpkg.exe 等注册工具必须实现 类 RegistrationAttribute.Key 和 RegistrationAttribute.RegistrationContext。

构造函数

RegistrationAttribute()

初始化此类的新实例。

属性

TypeId

重写 TypeID 属性,以便让 RegistrationAttribute 派生类与 System.ComponentModel.TypeDescriptor.GetAttributes 一起使用 (...) 。仅当派生自此属性的属性需要对可应用于类的实例使用更好的控件时,它才必须重写此属性。

方法

GetPackageRegKeyPath(Guid)

获取相对于 VSPackage 的应用程序) 注册表根目录 (注册表路径。

Register(RegistrationAttribute+RegistrationContext)

当外部注册工具(如 regpkg.exe)调用时,向给定上下文注册此 VSPackage。 有关详细信息,请参阅注册 VSPackage。

Unregister(RegistrationAttribute+RegistrationContext)

调用以便向给定的上下文撤消注册此属性。

适用于