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 | |
---|---|---|
ProvideCodeGeneratorAttribute |
Top
Properties
Name | Description | |
---|---|---|
Description | A human readable description of this generator | |
GeneratesDesignTimeSource | If true, this code generator provides design-time source code | |
Name | The name of this generator. To apply this generator to a file in Solution Explorer, set its Custom Tool property to this name. | |
ProjectSystem | The project system with which this code generator is registered. | |
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. | |
Type | The type implementing the Code Generator | |
TypeId | (Inherited from RegistrationAttribute.) |
Top
Methods
Name | Description | |
---|---|---|
Equals | Infrastructure. Returns a value that indicates whether this instance is equal to a specified object. (Inherited from Attribute.) | |
GetHashCode | Returns the hash code for this instance. (Inherited from Attribute.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
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.) | |
Match | When overridden in a derived class, returns a value that indicates whether this instance equals a specified object. (Inherited from Attribute.) | |
Register | (Overrides RegistrationAttribute.Register(RegistrationAttribute.RegistrationContext).) | |
ToString | Returns a string that represents the current object. (Inherited from Object.) | |
Unregister | (Overrides RegistrationAttribute.Unregister(RegistrationAttribute.RegistrationContext).) |
Top
Fields
Name | Description | |
---|---|---|
AspNetProjectGuid | Guid of the ASP.Net Project System package | |
CSharpProjectGuid | Guid of the C# Project System package | |
VisualBasicProjectGuid | Guid of the Visual Basic Project System package |
Top
Explicit Interface Implementations
Name | Description | |
---|---|---|
System#Runtime#InteropServices#_Attribute#GetIDsOfNames | Maps a set of names to a corresponding set of dispatch identifiers. (Inherited from Attribute.) | |
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.) | |
System#Runtime#InteropServices#_Attribute#GetTypeInfoCount | Retrieves the number of type information interfaces that an object provides (either 0 or 1). (Inherited from Attribute.) | |
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.