Export (0) Print
Expand All

ITextTemplatingEngineHost.GetHostOption Method

Called by the Engine to ask for the value of a specified option. Return null if you do not know.

Namespace:  Microsoft.VisualStudio.TextTemplating
Assembly:  Microsoft.VisualStudio.TextTemplating.Interfaces.10.0 (in Microsoft.VisualStudio.TextTemplating.Interfaces.10.0.dll)

'Declaration
Function GetHostOption ( _
	optionName As String _
) As Object

Parameters

optionName
Type: String

The name of an option.

Return Value

Type: Object
Null to select the default value for this option. Otherwise, an appropriate value for the option.

Currently, the only option invoked by the Engine is CacheAssemblies. It returns true if assemblies are retained between successive text template processing runs. The standard hosts return true, unless the string value CacheAssemblies="false" is set in the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\version\TextTemplating\.

The following code example shows a possible implementation for a custom host. This code example is part of a larger example. For the complete example, see Walkthrough: Creating a Custom Text Template Host.

public object GetHostOption(string optionName)
{
  object returnObject;
  switch (optionName)
  {
    case "CacheAssemblies":
      returnObject = true;
      break;
    default:
      returnObject = null;
      break;
  }
  return returnObject;
}

Show:
© 2014 Microsoft