RegisterEditorExtensionAttribute Class

Definition

Warning

This API is now obsolete.

See ProvideEditorExtensionAttribute. Registers a file extension with a given editor factory. This class cannot be inherited.

public ref class RegisterEditorExtensionAttribute sealed : Microsoft::VisualStudio::Shell::RegistrationAttribute
public ref class RegisterEditorExtensionAttribute sealed : Microsoft::VisualStudio::Shell::RegistrationAttribute
[System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=true, Inherited=true)]
[System.Obsolete("RegisterEditorExtensionAttribute has been deprecated. Please use ProvideEditorExtensionAttribute instead.")]
public sealed class RegisterEditorExtensionAttribute : Microsoft.VisualStudio.Shell.RegistrationAttribute
type RegisterEditorExtensionAttribute = class
    inherit RegistrationAttribute
Public NotInheritable Class RegisterEditorExtensionAttribute
Inherits RegistrationAttribute
Inheritance
RegisterEditorExtensionAttribute
Attributes

Remarks

When to Call

Apply the RegisterEditorExtensionAttribute attribute to classes implementing an editor factory

Basic Usage

This attribute associates a file extension with a given editor factory. The file extension should include the prefixing ".".

This attribute is used only for registration purposes and does not affect runtime behavior. It should be placed on a package class.

Each editor factory also has an associated priority. For a given file extension, the editors with the highest priority number are given the chance to read a file first. If the editor fails to read the file, the remaining editors are used in order of priority. To use RegisterEditorExtensionAttribute, place it on a package class, such as Package or IVsPackage.

Registry Entries

The following registry entry is created by RegisterEditorExtensionAttribute:

<VSROOT>\Editors\{FactoryGuid}\Extensions\Extension=Priority

Note The GUIDS for the Visual C# and Visual Basic project types are:

C#: {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}

VB: {F184B08F-C81C-45F6-A57F-5ABD9991F28F}

Samples

You can find implementations of RegisterEditorExtensionAttribute in the managed samples. The standard location for this and all other attributes used for automatic registration is adjacent to the implementation of Package in VsPkg.cs, VsPkg.vb, or VsPkg.cpp, depending on the language used in the sample.

Note

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

Constructors

RegisterEditorExtensionAttribute(Object, String, Int32)

Initializes a new RegisterEditorExtensionAttribute for the supplied factory type and extension.

Properties

EditorFactoryNotify

Gets or sets whether or not to create the EditorFactoryNotify registry key on registration.

Extension

Gets the file extension of the file.

Factory

Gets the editor factory GUID.

NameResourceID

Gets or sets the name resource ID.

Priority

Gets the priority of this extension registration.

ProjectGuid

Gets or sets the project GUID.

TemplateDir

Gets or sets the template directory.

TypeId

Override the TypeID property in order to let the RegistrationAttribute derived classes to work with System.ComponentModel.TypeDescriptor.GetAttributes(...). An attribute derived from this one will have to override this property only if it needs a better control on the instances that can be applied to a class.

(Inherited from RegistrationAttribute)

Methods

GetPackageRegKeyPath(Guid)

Gets the registry path (relative to the registry root of the application) of the VSPackage.

(Inherited from RegistrationAttribute)
Register(RegistrationAttribute+RegistrationContext)

Registers the editor extension.

Unregister(RegistrationAttribute+RegistrationContext)

Removes the editor extension registry key.

Applies to