【发布时间】:2009-07-15 14:58:08
【问题描述】:
我正在尝试通过 T4 生成一些代码,当我在模板中包含 指令时收到以下错误。
vbc:命令行 (0,0):错误 BC2006:编译转换:选项 'r' 需要 ':(file_list)
如果我使用 作为我的指令,它工作得很好。此外,如果我不尝试通过代码生成并仅保存 .tt 文件,它可以与 VBv3.5 指令一起正常工作。
这是我的 t4 模板。
<#@ output extension="txt" #>
<#@ assembly name="Microsoft.SqlServer.ConnectionInfo" #>
<#@ assembly name="Microsoft.SqlServer.Smo" #>
<#@ assembly name="System.Configuration" #>
<#@ assembly name="Microsoft.VisualBasic" #>
hello world
这是我的 .NET 代码
Dim host As CustomCmdLineHost = New CustomCmdLineHost()
Dim engine As Engine = New Engine()
host.TemplateFileValue = sTemplateFile
'Read the text template.
Dim input As String = File.ReadAllText(sTemplateFile)
'Transform the text template.
Dim output As String = engine.ProcessTemplate(input, host)
【问题讨论】: