Saeid
Saeid

Reputation: 13582

Use T4 template as a dll

Is there any way to create dll from T4 templates and generate codes from this dll? At now I need to set parameters by hard coded and when you save (Press Ctrl + S), the template start to generate, but there must be a good reusable way. does any one have any suggestion?

Update

I need a Library Application Include T4 Templates and I can pass parameters from any app that referenced to this library and get generated code as a return. but i don't know how can I create a dll from T4

Upvotes: 0

Views: 664

Answers (1)

GarethJ
GarethJ

Reputation: 6606

What you want is Runtime (also called Preprocessed) templates. With these you'll generate the template code rather than the template output. You can then embed that code in any part of your app with no runtime dependencies on T4.

MSDN docs: http://msdn.microsoft.com/en-us/library/ee844259.aspx

Oleg Sych's blog on the subject: http://www.olegsych.com/2009/09/t4-preprocessed-text-templates

Upvotes: 2

Related Questions