Bagikan melalui


TemplatedPreprocessor Class

Creates source code that can be compiled and run to generate the output defined by the text template. Typically the code generated by these run-time templates is used as part of an application.

Only a single generator is needed for any style of template as the custom code is handled with directive providers.

Inheritance Hierarchy

System.Object
  Microsoft.VisualStudio.TextTemplating.VSHost.BaseCodeGenerator
    Microsoft.VisualStudio.TextTemplating.VSHost.BaseCodeGeneratorWithSite
      Microsoft.VisualStudio.TextTemplating.VSHost.BaseTemplatedCodeGenerator
        Microsoft.VisualStudio.TextTemplating.VSHost.TemplatedPreprocessor

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

Syntax

'Declaration
<GuidAttribute("F56DB4B6-C280-40f1-855D-5DA0ED7BD270")> _
Public Class TemplatedPreprocessor _
    Inherits BaseTemplatedCodeGenerator
[GuidAttribute("F56DB4B6-C280-40f1-855D-5DA0ED7BD270")]
public class TemplatedPreprocessor : BaseTemplatedCodeGenerator
[GuidAttribute(L"F56DB4B6-C280-40f1-855D-5DA0ED7BD270")]
public ref class TemplatedPreprocessor : public BaseTemplatedCodeGenerator
[<GuidAttribute("F56DB4B6-C280-40f1-855D-5DA0ED7BD270")>]
type TemplatedPreprocessor =  
    class
        inherit BaseTemplatedCodeGenerator
    end
public class TemplatedPreprocessor extends BaseTemplatedCodeGenerator

The TemplatedPreprocessor type exposes the following members.

Constructors

  Name Description
Public method TemplatedPreprocessor

Top

Properties

  Name Description
Protected property Dte Get the DTE object (Inherited from BaseCodeGeneratorWithSite.)
Protected property ErrorList Get the Vs ErrorList object (Inherited from BaseCodeGeneratorWithSite.)
Protected property FileNamespace namespace for the file. (Inherited from BaseCodeGenerator.)
Protected property GlobalServiceProvider Provides a wrapper on the global service provider for Visual Studio (Inherited from BaseCodeGeneratorWithSite.)
Protected property InputFilePath file-path for the input file. (Inherited from BaseCodeGenerator.)
Protected property SiteServiceProvider Get a wrapper on the containing project system's Service provider <remarks> This is a limited service provider that can only reliably provide VxDTE::SID_SVSProjectItem SID_SVSWebReferenceDynamicProperties IID_IVsHierarchy SID_SVsApplicationSettings To get the global provider, call GetSite on IVSHierarchy or use the GlobalServiceProvider property </remarks> (Inherited from BaseCodeGeneratorWithSite.)
Protected property TextTemplating Get the TextTemplating service from Visual Studio (Inherited from BaseTemplatedCodeGenerator.)

Top

Methods

  Name Description
Protected method CreateExceptionMessage Create a message to display to the user, given an exception. (Inherited from BaseCodeGeneratorWithSite.)
Public method Dispose() Releases all resources used by this instance. (Inherited from BaseCodeGenerator.)
Protected method Dispose(Boolean) (Inherited from BaseCodeGeneratorWithSite.)
Public method Equals Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Public method ErrorCallback (Inherited from BaseTemplatedCodeGenerator.)
Protected method Finalize (Inherited from BaseCodeGenerator.)
Public method Generate (Inherited from BaseCodeGenerator.)
Protected method GenerateCode (Inherited from BaseTemplatedCodeGenerator.)
Protected method GeneratorErrorCallback (Inherited from BaseCodeGenerator.)
Public method GetDefaultExtension Get the extension of the file that should be created (Inherited from BaseTemplatedCodeGenerator.)
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Protected method GetService(Guid) (Inherited from BaseCodeGeneratorWithSite.)
Protected method GetService(Type) (Inherited from BaseCodeGeneratorWithSite.)
Public method GetSite (Inherited from BaseCodeGeneratorWithSite.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Protected method ProcessTemplate Create source code that can later be compiled and run to generate the output defined by the template. (Overrides BaseTemplatedCodeGenerator.ProcessTemplate(String, String, ITextTemplating, IVsHierarchy).)
Public method SetFileExtension (Inherited from BaseTemplatedCodeGenerator.)
Public method SetOutputEncoding (Inherited from BaseTemplatedCodeGenerator.)
Public method SetSite (Inherited from BaseCodeGeneratorWithSite.)
Protected method SetWaitCursor Set the wait cursor until the end of this generation (Inherited from BaseCodeGeneratorWithSite.)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)

Top

Explicit Interface Implementations

  Name Description
Explicit interface implemetationPrivate method IVsSingleFileGenerator.DefaultExtension (Inherited from BaseCodeGenerator.)
Explicit interface implemetationPrivate method IVsSingleFileGenerator.Generate (Inherited from BaseCodeGenerator.)

Top

Remarks

For more information, see Run-Time Text Generation by using Preprocessed T4 Text Templates.

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