Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2005
Visual Studio
Visual Studio SDK
 How to: Call a Custom Directive

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:
Domain-Specific Language Tools 
How to: Call a Custom Directive 

When you create a text template, you can call one or more of the five built-in directives: assembly, import, template, output, and include. For example, you call the output directive by using the following syntax:

<#@ output extension=".txt" #>

In addition to calling built-in directives, you can also call custom directive processors. For more information, see Architecture of the Text Template Transformation Process.

To call a custom directive processor from a text template, you must add an extra parameter for the name of the directive processor. The name of the directive processor matches the name of the directive processor's key in the registry. For more information, see How to: Set Registry Keys for Custom Directive Processors.

To call a custom directive processor

  • In your text template file, add a custom directive statement, and specify the name of the directive processor. The syntax is the following:

    <#@ DirectiveName Processor="DirectiveProcessorName" ParameterName="ParameterValue" #>

    For example, use the following syntax to call the CoolDirective custom directive, which is located in a directive processor named CustomDirectiveProcessor and that requires a parameter named FileName:

    <#@ CoolDirective Processor="CustomDirectiveProcessor" FileName="C:\UserFiles\data.xml" #>
    NoteNote

    To debug text templates, you must set the debug parameter of the template directive. For more information, see How to: Debug Text Templates.

Security

For more information, see Security of Text Templates.

See Also

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker