Freigeben über


How to: Run Text Templates

A text template file contains a mixture of text blocks and control logic. You can use the control logic to combine the text blocks with the data held within a model to produce an output file. There are a variety of uses for text templates. For example, you can generate code or documentation from models. A text template contains both text blocks and control logic. These are read along with the model by the text transformation engine. The engine processes the text template to create the appropriate output file. The output file might be source code, xml, html, or some other deployable software artifact.

Once you have a text template that is ready to use, you can run it as described in the following procedures.

Hinweis

You can also use the VsTextTransform.exe command to run a text template from the command line. For more information, see TextTransform.

To run a single text template file

To run all text template files in a solution

  • On the Solution Explorer toolbar, click the Transform All Templates button.

    Hinweis

    If you created your own template and you do not see the Transform All Templates button on the Solution Explorer toolbar and you want it to appear, conduct one of the following actions:

    • Invoke the text template by right-clicking on it and selecting Run Custom Tool.

      -or-

    • Add the following into your solution file in the Global section (between the Global and EndGlobal markers):

      GlobalSection(TextTemplating) = postSolution  TextTemplating = 1EndGlobalSection
      

Security

For more information, see Security of Text Templates.

See Also

Concepts

Adding Code to Text Templates

Using Built-in Directives in Text Templates

Generating Artifacts Using Text Templates

Walkthrough: Creating and Running Text Templates