Share via


RequiresProvidesDirectiveProcessor.GetImportsForProcessingRun Method

Gets namespaces to import into the generated transformation class.

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

Syntax

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

Return Value

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

Implements

IDirectiveProcessor.GetImportsForProcessingRun()

Exceptions

Exception Condition
InvalidOperationException

A processing run has already started but not yet finished.

Remarks

To expose the code that is generated by a directive processor to the generated transformation class, have the directive processor add its namespace to the list of namespaces.

Examples

This example gets the set of extra namespaces that must be imported to compile the code that the directive processor generates. This code example is part of a larger example that is provided for the RequiresProvidesDirectiveProcessor class.

public override string[] GetImportsForProcessingRun()
{
List<string> imports = new List<string>();
imports.AddRange(base.GetImportsForProcessingRun());
imports.Add("System.Xml");
return imports.ToArray();
}

.NET Framework Security

See Also

Reference

RequiresProvidesDirectiveProcessor Class

Microsoft.VisualStudio.TextTemplating Namespace

GetReferencesForProcessingRun

GetClassCodeForProcessingRun

GetImportsForProcessingRun