I'm creating a t4 template that will generate an enum from a number of values in our database. The weird thing is that as soon as I try to create a DataTable in the template code i get the ErrorGeneratingOutput message:
<#@ template language="C#v3.5" debug="True" #>
<#@ output extension="CS" #>
<#@ assembly name="System.Data" #>
<#@ assembly name="System.Configuration" #>
<#@ import namespace="System.Data" #>
<#@ import namespace="System.Data.SqlClient" #>
<#@ import namespace="System.Data.Common" #>
public enum Foo
{
<#
//DataTable table = new System.Data.DataTable();
#>
}
When the line where the table is created is commented out there is no problem but if I remove the comment I get an error. I'm pulling my hair on this one, what am I missing?