ITextTemplatingEngineHost.StandardAssemblyReferences 属性

获取程序集引用的列表。

命名空间:  Microsoft.VisualStudio.TextTemplating
程序集:  Microsoft.VisualStudio.TextTemplating.Interfaces.10.0(在 Microsoft.VisualStudio.TextTemplating.Interfaces.10.0.dll 中)

语法

声明
ReadOnly Property StandardAssemblyReferences As IList(Of String)
IList<string> StandardAssemblyReferences { get; }
property IList<String^>^ StandardAssemblyReferences {
    IList<String^>^ get ();
}
abstract StandardAssemblyReferences : IList<string>
function get StandardAssemblyReferences () : IList<String>

属性值

类型:System.Collections.Generic.IList<String>
一个 IList,其中包含程序集名称。

备注

允许主机指定由生成的转换类(例如 System.dll)引用的标准程序集 引擎在编译和执行生成的转换类时,使用这些引用。

示例

下面的代码示例演示了自定义主机的可能实现。 此代码示例摘自一个更大的示例。 有关完整的示例,请参见演练:创建自定义文本模板宿主

public IList<string> StandardAssemblyReferences
{
    get
    {
        return new string[]
        {
            //if this host searches standard paths and the GAC
            //we can specify the assembly name like this
            //---------------------------------------------------------
            //"System"

            //because this host only resolves assemblies from the 
            //fully qualified path and name of the assembly
            //this is a quick way to get the code to give us the
            //fully qualified path and name of the System assembly
            //---------------------------------------------------------
            typeof(System.Uri).Assembly.Location
        };
    }
}
Public ReadOnly Property StandardAssemblyReferences() As IList(Of String) Implements Microsoft.VisualStudio.TextTemplating.ITextTemplatingEngineHost.StandardAssemblyReferences
    Get
        'if this host searches standard paths and the GAC
        'we can specify the assembly name like this
        '---------------------------------------------------------
        'Return New String() {"System"}

        'because this host only resolves assemblies from the 
        'fully qualified path and name of the assembly
        'this is a quick way to get the code to give us the
        'fully qualified path and name of the System assembly
        '---------------------------------------------------------
        Return New String() {(New System.UriBuilder()).GetType().Assembly.Location}
    End Get
End Property

.NET Framework 安全性

请参见

参考

ITextTemplatingEngineHost 接口

Microsoft.VisualStudio.TextTemplating 命名空间

其他资源

演练:创建自定义文本模板宿主

代码生成和 T4 文本模板