次の方法で共有


PackageRegistrationAttribute Class

Modify your class that implements IVsPackage by using this attribute so that the registration tool, RegPkg.exe, will look for additional attributes. For more information, see Registering VSPackages.

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

Syntax

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

Remarks

RegPkg.exe uses C# reflection to determine the attributes that modify your assembly-implemented package. RegPkg.exe then evaluates each attribute by using information that is specific to the current installation, and then creates registry entries that describe the package to Visual Studio. If your class inherits from the Managed Package Framework (MPF) class Package, this attribute is already included. If you create your own class that implements IVsPackage, manually modify your class by using one PackageRegistrationAttribute or the package will not load.

Inheritance Hierarchy

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

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

PackageRegistrationAttribute Members

Microsoft.VisualStudio.Shell Namespace