ProvideAutoLoadAttribute 类

定义

此属性将包注册为扩展程序。 传入的 GUID 决定了要扩展的内容。 包上的属性不控制包的行为,但注册工具可以使用它们向 Visual Studio 注册适当的信息。

public ref class ProvideAutoLoadAttribute sealed : Microsoft::VisualStudio::Shell::RegistrationAttribute
public ref class ProvideAutoLoadAttribute sealed : Microsoft::VisualStudio::Shell::RegistrationAttribute
[System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=true, Inherited=true)]
public sealed class ProvideAutoLoadAttribute : Microsoft.VisualStudio.Shell.RegistrationAttribute
[<System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=true, Inherited=true)>]
type ProvideAutoLoadAttribute = class
    inherit RegistrationAttribute
Public NotInheritable Class ProvideAutoLoadAttribute
Inherits RegistrationAttribute
继承
ProvideAutoLoadAttribute
属性

注解

将此属性应用于继承自 Package 或 实现 IVsPackage 的 VSPackage 类,以在指定的 UI 上下文处于活动状态时自动加载类。

此属性使 VSPackage 成为实现 IExtenderProvider) (对象的扩展程序。 传递给构造函数的 GUID 确定加载包的上下文。

此属性类仅用于为外部注册工具提供数据。 它对 VSPackage 的运行时行为没有任何影响。

注意

Visual C# 会自动将“Attribute”一词追加到任何属性类的名称中。 在 Visual C# 代码中,将此属性称为 ProvideAutoLoad

注意

Visual C# 和 Visual Basic 项目类型的 GUID 分别为 {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 和 {F184B08F-C81C-45F6-A57F-5ABD9991F28F}。

注册表项

以下注册表项由 ProvideAutoLoadAttribute创建:

  • <VSROOT>\AutoLoadPackages\{ContextGuid}

  • <VSROOT>\AutoLoadPackages\{ContextGuid}\{PackageGuid}=0

构造函数

ProvideAutoLoadAttribute(String)

指定此上下文处于活动状态时应加载包。

ProvideAutoLoadAttribute(String, PackageAutoLoadFlags)

指定此上下文处于活动状态时应加载包。

属性

Flags

指定包自动加载条目的选项

LoadGuid

触发包加载的上下文 Guid。

TypeId

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

(继承自 RegistrationAttribute)

方法

GetPackageRegKeyPath(Guid)

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

(继承自 RegistrationAttribute)
Register(RegistrationAttribute+RegistrationContext)

调用以便向给定的上下文注册此属性。 上下文包含应放置注册信息的位置。 它还包含正在注册的类型和路径信息。

Unregister(RegistrationAttribute+RegistrationContext)

取消注册此自动加载规范。

适用于