我试图通过 T4 生成一些代码,当我在模板中包含 <#@ template language="VBv3.5"#> 指令时收到以下错误。
vbc:命令行(0,0):错误BC2006:编译转换:选项'r'需要':(file_list)
如果我使用 <#@ template language="C#v3.5"#> 作为我的指令,它工作得很好。此外,如果我不尝试通过代码生成并仅保存 .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)