TextTransformation.Initialize Method ()


This API supports the product infrastructure and is not intended to be used directly from your code.

Initializes the TextTransformation class.

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

public virtual void Initialize()

false to indicate that no errors occurred during initialization. true stops processing of the text template.

Directive processors can add code to the override of this method in the generated transformation class by adding code to the GetPreInitializationCodeForProcessingRun and GetPostInitializationCodeForProcessingRun. GetPreInitializationCodeForProcessingRun adds code to the beginning of the Initialize method, and GetPostInitializationCodeForProcessingRun adds code to the end of the Initialize method.

For example, the following pseudo-code shows what the Initialize method of the generated transformation class might look like:

Method GeneratedTransformationClassInstance.Initialize()


<code added by GetPreInitializationCodeForProcessingRun()>

base.Initialize() *This is a call to TextTransformation.Initialize()

<code added by GetPostInitializationCodeForProcessingRun()>


You can log an error during Initialize to stop the text template transformation process. The transformation engine checks the Errors property of the TextTransformation class after Initialize completes, and stops processing if it contains any errors.

Return to top