Understanding T4: <#@ output #> directive


Here is how MSDN documentation defines the output directive.

By using the output directive, you can specify characteristics of the generated text output, such as the file name extension

This directive does not affect code of GeneratedTextTransformation. Instead, it results in SetFileExtension and SetOutputEncoding methods of the ITextTemplatingEngineHost being called when the compiled template is executed.

About T4

T4 (Text Template Transformation Toolkit) is a template-based code generation engine. It is available in Visual Studio 2008 and as a download in DSL and GAT toolkits for Visual Studio 2005. T4 engine allows you to use ASP.NET-like template syntax to generate C#, T-SQL, XML or any other text files.

Ready for more? Read about <#@ import #> directive or go back to the overview.


Write a Comment

Take a moment to comment and tell us what you think. Some basic HTML is allowed for formatting.

Reader Comments

Be the first to leave a comment!