This documentation is archived and is not being maintained.

ProvideLanguageExtensionAttribute Class

Associates a file extension with a particular language service.

Namespace:  Microsoft.VisualStudio.Shell
Assembly:  Microsoft.VisualStudio.Shell.9.0 (in Microsoft.VisualStudio.Shell.9.0.dll)

[AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
public sealed class ProvideLanguageExtensionAttribute : RegistrationAttribute

This user-defined C# attribute is used to register with Visual Studio a file extension for a particular language service. This attribute puts the necessary information into the assembly's metadata that is later retrieved and used by regpkg.exe. You must still register the language service itself; this attribute only makes the association between the file extension and the language service. For more information, see Registering VSPackages (C#).

You can use multiple instances of this attribute to associate multiple file extensions with your language service.

The registry key that is affected by this attribute exists under the Visual Studio registry key:

    File Extensions\
        (Default) = RG_SZ: [LanguageServiceGuid]


  • [X.Y] is a Visual Studio version number such as 8.0 or 8.0exp.

  • [FileExtension] is a string containing the file extension with the leading period; for example, "myext".

  • [LanguageServiceGuid] is the GUID of your language service; for example, {B614A40A-80D9-4FAC-A6AD-FC2868FFF7CD}.

The following user-defined attributes are used for language services:




Registers the language service with Visual Studio and specifies what features are supported.


Associates a file extension with the language service.


Specifies a property node or page for the Options dialog box specific to the language service.


Specifies location information to support code snippets in the language service.


Registers a language service as a Visual Studio service. All services supplied in managed code use this attribute.

Notes to Implementers:

This attribute class cannot be inherited from so there is nothing to implement.

Notes to Callers:

Use this attribute on your VSPackage to associate a file extension with your language service.

This example shows how to associate the file extension ".myext" with a language service.


Visual C# allows for a shorthand form of a user-defined attribute by dropping the "Attribute" part of the name. This shorthand form is used in this and all other examples throughout this class.

using Microsoft.VisualStudio.Shell;

namespace MyLanguagePackage
    [ProvideLanguageExtension(typeof(MyLanguageService), ".myext")]
    public class MyLanguagePackage : Package


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.