Share via


ProvideCodeGeneratorAttribute Class

Apply this attribute to the package class in a Visual Studio extension that provides a custom tool.

This API is not CLS-compliant. 

Inheritance Hierarchy

Object
  Attribute
    Microsoft.VisualStudio.Shell.RegistrationAttribute
      Microsoft.VisualStudio.TextTemplating.VSHost.ProvideCodeGeneratorAttribute

Namespace:  Microsoft.VisualStudio.TextTemplating.VSHost
Assembly:  Microsoft.VisualStudio.TextTemplating.VSHost.11.0 (in Microsoft.VisualStudio.TextTemplating.VSHost.11.0.dll)

Syntax

'Declaration
<CLSCompliantAttribute(False)> _
<AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple := True, Inherited := False)> _
Public NotInheritable Class ProvideCodeGeneratorAttribute _
    Inherits RegistrationAttribute
[CLSCompliantAttribute(false)]
[AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
public sealed class ProvideCodeGeneratorAttribute : RegistrationAttribute
[CLSCompliantAttribute(false)]
[AttributeUsageAttribute(AttributeTargets::Class, AllowMultiple = true, Inherited = false)]
public ref class ProvideCodeGeneratorAttribute sealed : public RegistrationAttribute
[<Sealed>]
[<CLSCompliantAttribute(false)>]
[<AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple = true, Inherited = false)>]
type ProvideCodeGeneratorAttribute =  
    class 
        inherit RegistrationAttribute 
    end
public final class ProvideCodeGeneratorAttribute extends RegistrationAttribute

The ProvideCodeGeneratorAttribute type exposes the following members.

Constructors

  Name Description
Public method ProvideCodeGeneratorAttribute

Top

Properties

  Name Description
Public property Description A human readable description of this generator
Public property GeneratesDesignTimeSource If true, this code generator provides design-time source code
Public property Name The name of this generator. To apply this generator to a file in Solution Explorer, set its Custom Tool property to this name.
Public property ProjectSystem The project system with which this code generator is registered.
Public property RegisterCodeBase If true, the generator is registered using a codebase - that is, a specific assembly file location. If false, the assembly is in the GAC.
Public property Type The type implementing the Code Generator
Public property TypeId (Inherited from RegistrationAttribute.)

Top

Methods

  Name Description
Public method Equals Infrastructure. Returns a value that indicates whether this instance is equal to a specified object. (Inherited from Attribute.)
Public method GetHashCode Returns the hash code for this instance. (Inherited from Attribute.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method IsDefaultAttribute When overridden in a derived class, indicates whether the value of this instance is the default value for the derived class. (Inherited from Attribute.)
Public method Match When overridden in a derived class, returns a value that indicates whether this instance equals a specified object. (Inherited from Attribute.)
Public method Register (Overrides RegistrationAttribute.Register(RegistrationAttribute.RegistrationContext).)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)
Public method Unregister (Overrides RegistrationAttribute.Unregister(RegistrationAttribute.RegistrationContext).)

Top

Fields

  Name Description
Public fieldStatic member AspNetProjectGuid Guid of the ASP.Net Project System package
Public fieldStatic member CSharpProjectGuid Guid of the C# Project System package
Public fieldStatic member VisualBasicProjectGuid Guid of the Visual Basic Project System package

Top

Explicit Interface Implementations

  Name Description
Explicit interface implemetationPrivate method System#Runtime#InteropServices#_Attribute#GetIDsOfNames Maps a set of names to a corresponding set of dispatch identifiers. (Inherited from Attribute.)
Explicit interface implemetationPrivate method System#Runtime#InteropServices#_Attribute#GetTypeInfo Retrieves the type information for an object, which can be used to get the type information for an interface. (Inherited from Attribute.)
Explicit interface implemetationPrivate method System#Runtime#InteropServices#_Attribute#GetTypeInfoCount Retrieves the number of type information interfaces that an object provides (either 0 or 1). (Inherited from Attribute.)
Explicit interface implemetationPrivate method System#Runtime#InteropServices#_Attribute#Invoke Provides access to properties and methods exposed by an object. (Inherited from Attribute.)

Top

Remarks

This attribute registers your Visual Studio extension as a custom tool. When a user has installed an extension that has this attribute, they can use it to generate files using the Run Custom Tool command in Solution Explorer.

This attribute performs automatically the registration task that is described in Registering Single File Generators.

Apply the attribute to the package class (not the generator class).

See also ProvideCodeGeneratorExtensionAttribute.

Examples

[ProvideCodeGenerator(typeof(MyGenerator), "MyCustomTool", "My custom tool", true, ProjectSystem = ProvideCodeGeneratorAttribute.CSharpProjectGuid)]
internal sealed partial class MyPackage : Microsoft.VisualStudio.Shell
.Package
{ ... }
internal class MyGenerator : Microsoft.VisualStudio.Shell.Interop.IVsSingleFileGenerator
{ ... }

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

Microsoft.VisualStudio.TextTemplating.VSHost Namespace