Export (0) Print
Expand All

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. 

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

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

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

The ProvideCodeGeneratorAttribute type exposes the following members.

  NameDescription
Public propertyDescriptionA human readable description of this generator
Public propertyGeneratesDesignTimeSourceIf true, this code generator provides design-time source code
Public propertyNameThe name of this generator. To apply this generator to a file in Solution Explorer, set its Custom Tool property to this name.
Public propertyProjectSystemThe project system with which this code generator is registered.
Public propertyRegisterCodeBaseIf true, the generator is registered using a codebase - that is, a specific assembly file location. If false, the assembly is in the GAC.
Public propertyTypeThe type implementing the Code Generator
Public propertyTypeId (Inherited from RegistrationAttribute.)
Top

  NameDescription
Public methodEqualsInfrastructure. Returns a value that indicates whether this instance is equal to a specified object. (Inherited from Attribute.)
Public methodGetHashCodeReturns the hash code for this instance. (Inherited from Attribute.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodIsDefaultAttributeWhen overridden in a derived class, indicates whether the value of this instance is the default value for the derived class. (Inherited from Attribute.)
Public methodMatchWhen overridden in a derived class, returns a value that indicates whether this instance equals a specified object. (Inherited from Attribute.)
Public methodRegister (Overrides RegistrationAttribute.Register(RegistrationAttribute.RegistrationContext).)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Public methodUnregister (Overrides RegistrationAttribute.Unregister(RegistrationAttribute.RegistrationContext).)
Top

  NameDescription
Public fieldStatic memberAspNetProjectGuidGuid of the ASP.Net Project System package
Public fieldStatic memberCSharpProjectGuidGuid of the C# Project System package
Public fieldStatic memberVisualBasicProjectGuidGuid of the Visual Basic Project System package
Top

  NameDescription
Explicit interface implemetationPrivate method_Attribute.GetIDsOfNamesMaps a set of names to a corresponding set of dispatch identifiers. (Inherited from Attribute.)
Explicit interface implemetationPrivate method_Attribute.GetTypeInfoRetrieves 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_Attribute.GetTypeInfoCountRetrieves the number of type information interfaces that an object provides (either 0 or 1). (Inherited from Attribute.)
Explicit interface implemetationPrivate method_Attribute.InvokeProvides access to properties and methods exposed by an object. (Inherited from Attribute.)
Top

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.
Show:
© 2014 Microsoft