ProvideCodeGeneratorAttribute Class

 

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

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

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

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

NameDescription
System_CAPS_pubpropertyDescription

A human readable description of this generator

System_CAPS_pubpropertyGeneratesDesignTimeSource

If true, this code generator provides design-time source code

System_CAPS_pubpropertyName

The name of this generator. To apply this generator to a file in Solution Explorer, set its Custom Tool property to this name.

System_CAPS_pubpropertyProjectSystem

The project system with which this code generator is registered.

System_CAPS_pubpropertyRegisterCodeBase

If true, the generator is registered using a codebase - that is, a specific assembly file location. If false, the assembly is in the GAC.

System_CAPS_pubpropertyType

The type implementing the Code Generator

System_CAPS_pubpropertyTypeId

(Inherited from RegistrationAttribute.)

NameDescription
System_CAPS_pubfieldSystem_CAPS_staticAspNetProjectGuid

Guid of the ASP.Net Project System package

System_CAPS_pubfieldSystem_CAPS_staticCSharpProjectGuid

Guid of the C# Project System package

System_CAPS_pubfieldSystem_CAPS_staticVisualBasicProjectGuid

Guid of the Visual Basic Project System package

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.

[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
{ ... }

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

Return to top
Show: