I'm using SubSonic 3 (ActiveRecord mode) to generate the code for my DAL. It uses T4 templates (.tt) files that as soon as you save, generate the code for you.
I want to automate this as part of my NANT build, but I can't get this to work. I know that MS provide a tool called TextTransform to generate the code from T4 templates, but in the case of the SubSonic templates this doesn't seem to work - I think the templates make some assumptions about the template being run from within Visual Studio, which doesn't seem to work from the command line. The error I get when I try to run it against ActiveRecord.tt is:
Subsonic\ActiveRecord.tt(0,0) : error : Running transformation: System.InvalidCastException: Unable to cast object of type 'Microsoft.VisualStudio.TextTemplating.CommandLine.CommandLineHost' to type 'System.IServiceProvider'. at Microsoft.VisualStudio.TextTemplating3d54bbced2424853b667e74a81b9089b. GeneratedTextTransformation.GetCurrentProject() in c:\Users\matt.roberts\AppData\Loc al\Temp\subsonic\Settings.ttinclude:line 103 at Microsoft.VisualStudio.TextTemplating3d54bbced2424853b667e74a81b9089b. GeneratedTextTransformation.GetConnectionString(String connectionStringName) in c:\U sers\matt.roberts\AppData\Local\Temp\subsonic\Settings.ttinclude:line 51 at Microsoft.VisualStudio.TextTemplating3d54bbced2424853b667e74a81b9089b. GeneratedTextTransformation.get_ConnectionString() in c:\Users\matt.roberts\AppData\ Local\Temp\subsonic\Settings.ttinclude:line 87
Has anyone managed to automate this generation?
Thanks
Matt.