views:

112

answers:

1

I am attempting to generate some code via T4 and I am receiving the following error when I include the <#@ template language="VBv3.5"#> directive in my template.

vbc : Command line (0,0) : error BC2006: Compinling transformation: option 'r' requires ':(file_list)

If I use <#@ template language="C#v3.5"#> as my directive it works just fine. Also if I do not attempt to generate via code and just save the .tt file it works just fine with the VBv3.5 directive.

Here is my t4 template.

<#@ output extension="txt" #>
<#@ assembly name="Microsoft.SqlServer.ConnectionInfo" #>
<#@ assembly name="Microsoft.SqlServer.Smo" #>
<#@ assembly name="System.Configuration" #>
<#@ assembly name="Microsoft.VisualBasic" #>
hello world

Here is my .NET code

    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)
A: 

This works with the standard T4 hosts (in Visual Studio and TextTransform). Based on the error, it appears that your custom host doesn't provide the list of assembly references correctly.

Oleg Sych
Thanks for the response. I love your T4 tutorials by the way! I am able to get it to work just fine when just saving the .tt file in Visual Studio (I'm assuming that is what you mean by standard T4 hosts?). It just bombs when I include the VBv3.5 directive and execute the ProcessTemplate method while passing in the CustomCmdLineHost. If I remove the VBv3.5 directive or switch it to C#v3.5 everything works fine.
vonfeldj