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)


Function GetHostOption ( _
    optionName As String _
) As Object
Object GetHostOption(
    string optionName
Object^ GetHostOption(
    String^ optionName
abstract GetHostOption : 
        optionName:string -> Object
function GetHostOption(
    optionName : String
) : Object


  • 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;
      returnObject = null;
  return returnObject;

.NET Framework Security

See Also


ITextTemplatingEngineHost Interface

Microsoft.VisualStudio.TextTemplating Namespace

Other Resources

Walkthrough: Creating a Custom Text Template Host