I am using SubSonic 3 (ActiveRecord mode) to generate code for my DAL. It uses T4 templates (.tt) files, which, as soon as you save, generate code for you.
I want to automate this as part of my NANT build, but I cannot get this to work. I know that MS provides a TextTransform tool for generating code from T4 templates, but in the case of SubSonic templates this does not work - I think the templates make some assumptions about starting a template from Visual Studio, which does not seem to work from the command line. The error I get when I try to start it using ActiveRecord.tt:
Subsonic \ ActiveRecord.tt (0,0): error: Conversion started: System.InvalidCastException: cannot reset object of type "Microsoft.VisualStudio.TextTemplating.CommandLine.CommandLineHost" to enter "System.IServiceProvider". at Microsoft.VisualStudio.TextTemplating3d54bbced2424853b667e74a81b9089b. GeneratedTextTransformation.GetCurrentProject () in c: \ Users \ matt.roberts \ AppData \ Loc al \ Temp \ subsonic \ Settings.ttinclude: line 103 in Microsoft.VisualStudio.TextTemplating3d54bbced2424853b667e74a81b9089b. GeneratedTextTransformation.GetConnectionString (String connectionStringName) in c: \ U sers \ matt.roberts \ AppData \ Local \ Temp \ subsonic \ Settings.ttinclude: line 51 in Microsoft.VisualStudio.TextTemplating3d54bbced2424853b667e74a81b9089b. GeneratedTextTransformation.get_ConnectionString () in c: \ Users \ matt.roberts \ AppData \ Local \ Temp \ subsonic \ Settings.ttinclude: line 87
Has anyone been able to automate this generation?
thanks
Mt.
source share