共用方式為


ProvideAutoLoadAttribute Class

Apply this attribute to your VSPackage class to cause it to be automatically loaded when a specified UI context is active. This class cannot be inherited.

Namespace:  Microsoft.VisualStudio.Shell
Assemblies:   Microsoft.VisualStudio.Shell.10.0 (in Microsoft.VisualStudio.Shell.10.0.dll)
  Microsoft.VisualStudio.Shell (in Microsoft.VisualStudio.Shell.dll)
  Microsoft.VisualStudio.Shell.9.0 (in Microsoft.VisualStudio.Shell.9.0.dll)

Syntax

'宣告
<AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple := True, Inherited := True)> _
Public NotInheritable Class ProvideAutoLoadAttribute _
    Inherits RegistrationAttribute
'用途
Dim instance As ProvideAutoLoadAttribute
[AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
public sealed class ProvideAutoLoadAttribute : RegistrationAttribute
[AttributeUsageAttribute(AttributeTargets::Class, AllowMultiple = true, Inherited = true)]
public ref class ProvideAutoLoadAttribute sealed : public RegistrationAttribute
[<SealedAttribute>]
[<AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple = true, Inherited = true)>]
type ProvideAutoLoadAttribute =  
    class
        inherit RegistrationAttribute
    end
public final class ProvideAutoLoadAttribute extends RegistrationAttribute

Remarks

Apply this attribute to your VSPackage class that inherits from Package or implements IVsPackage to cause your class to be automatically loaded when a specified UI context is active.

This attribute makes your VSPackage an extender (an object which implements IExtenderProvider). The GUID passed to the constructor determines the context in which the package loads.

This attribute class is only used to provide data for external registration tools. It does not have any effect on the runtime behavior of the VSPackage.

注意

Visual C# automatically appends the word "Attribute" to the name of any attribute class. In Visual C# code, refer to this attribute as ProvideAutoLoad.

注意

The GUIDs for the Visual C# and Visual Basic project types are {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} and {F184B08F-C81C-45F6-A57F-5ABD9991F28F}, respectively.

Registry Entries

The following registry entries are created by ProvideAutoLoadAttribute:

  • <VSROOT>\AutoLoadPackages\{ContextGuid}

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

Inheritance Hierarchy

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

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

ProvideAutoLoadAttribute Members

Microsoft.VisualStudio.Shell Namespace