Generating Files with the TextTransform Utility
TextTransform.exe is a command-line tool that you can use to transform a text template outside Visual Studio. When you call TextTransform.exe, you specify the name of a text template file as an argument. TextTransform.exe calls the text transformation engine and processes the text template. TextTransform.exe is usually called from scripts. However, it is not usually required, because you can either perform the text transformation inside Visual studio, or in the build process.
Note
If you want to perform text transformation as part of a build process, consider using the MSBuild text transformation task. For more information, see Code Generation in a Build Process.
In a machine on which Visual Studio is installed, you can also write an application or Visual Studio Extension that can transform text templates. For more information, see Processing Text Templates by using a Custom Host.
TextTransform.exe is located in the following directory:
\Program Files\Common Files\Microsoft Shared\TextTemplating\10.0
TextTransform [<options>] <templateName>
Parameters
Argument |
Description |
---|---|
templateName |
Identifies the name of the template file that you want to transform. |
Option |
Description |
---|---|
-out <filename> |
The file to which the output of the transform is written. |
-r <assembly> |
An assembly used for compiling and running the text template. |
-u <namespace> |
A namespace that is used for compiling the template. |
-I <includedirectory> |
A directory that contains the text templates included in the specified text template. |
-P <referencepath> |
A directory to search for assemblies specified within the text template or for using the -r option. For example, to include assemblies used for the Visual Studio API, use -P "%VSSHELLFOLDER%\Common7\IDE\PublicAssemblies" |
-dp <processorName>!<className>!<assemblyName|codeBase> |
The name, full type name, and assembly of a directive processor that can be used to process custom directives within the text template. |
-a [processorName]![directiveName]!<parameterName>!<parameterValue>
Caution
Always type each '!' mark, even if you omit the optional processor and directive names. For example: -a !!param!value
|
Specify a parameter value for a directive processor. If you specify just the parameter name and value, the parameter will be available to all directive processors. If you specify a directive processor, the parameter is available only to the specified processor. If you specify a directive name, the parameter is available only when the specified directive is being processed. To access the parameter values from a directive processor or text template, use ResolveParameterValue(String, String, String). In a text template, include hostspecific in the template directive and invoke the message on this.Host. For example:
|
-h |
Provides help. |
Related topics
Task |
Topic |
---|---|
Generate files in a Visual Studio solution. |
|
Write directive processors to transform your own data sources. |
|
Write a text templating host that allows you to invoke text templates from your own application. |