Condividi tramite


DirectiveProcessor.GetReferencesForProcessingRun Method

When overridden in a derived class, gets references to pass to the generated transformation class compiler.

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

Syntax

'Declaration
Public MustOverride Function GetReferencesForProcessingRun As String()
public abstract string[] GetReferencesForProcessingRun()
public:
virtual array<String^>^ GetReferencesForProcessingRun() abstract
abstract GetReferencesForProcessingRun : unit -> string[] 
public abstract function GetReferencesForProcessingRun() : String[]

Return Value

Type: array<System.String[]
An array of type String that contains the references.

Implements

IDirectiveProcessor.GetReferencesForProcessingRun

Remarks

To compile successfully, the code that the directive processor adds to the generated transformation class might require particular assemblies. The directive processor should add references to the required assemblies in this method.

If the directive processor needs its own code to be available to the generated transformation class, the directive processor should add its own assembly to the list of references.

Examples

The following code example shows a possible implementation for a custom directive processor. This code example is part of a larger example provided for the DirectiveProcessor class.

public override string[] GetReferencesForProcessingRun()
{
    //We need a reference to this assembly to be able to call 
    //XmlReaderHelper.ReadXml from the generated transformation class.
    //-----------------------------------------------------------------
    return new string[]
    {
        "System.Xml",
        this.GetType().Assembly.Location
    };
}
Public Overrides Function GetReferencesForProcessingRun() As String()

    'We need a reference to this assembly to be able to call 
    'XmlReaderHelper.ReadXml from the generated transformation class.
    '-----------------------------------------------------------------
    Return New String() {"System.Xml", Me.GetType().Assembly.Location}
End Function

.NET Framework Security

See Also

Reference

DirectiveProcessor Class

Microsoft.VisualStudio.TextTemplating Namespace

GetImportsForProcessingRun

GetClassCodeForProcessingRun

GetReferencesForProcessingRun

Other Resources

Creating Custom T4 Text Template Directive Processors

Walkthrough: Creating a Custom Directive Processor