T4 Templating .sqlproj possible to build using MSBuild or TextTransform RRS feed

  • Question

  • Trying to process sqlproj T4 templates on the command line, happy to use TextTransform or MSBuild.

    Think (using TextTransform.exe) I need set -dp to get this directive to work <#@ SqlModelDirective processor="SqlModelDirectiveProcessor" #>

    Looking in Registry I get

    Microsoft.VisualStudio.Data.Tools.Package, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

    but cannot seem to get anything I try to work.

    Anybody know if it is possible to build templates from sqlproj's on the commandline?

    and if so how?

    Any help much appreciated.

    • Edited by OzzyGeoff Saturday, June 21, 2014 4:44 PM typo
    • Changed type OzzyGeoff Sunday, June 22, 2014 12:05 PM wrong type
    Saturday, June 21, 2014 4:40 PM

All replies

  • Unfortunately T4 templates which use the DacFx model do not run from the commandline.  There is some unique code when launching the directive processor which sites it with the model you wish to use.  Additionally the site must be serializable since it'll be marshaling data across the T4 app domain boundary. If you're interested in the details use ILSpy and check out SingleFileGenerator InvokeGenerator in Microsoft.VisualStudio.Data.Tools.Package.dll.

    Friday, July 18, 2014 3:44 PM
  • Many thanks
    Monday, July 21, 2014 6:50 AM