This project is read-only.

How to programatically run template files?

Feb 16, 2010 at 11:03 PM

Hi,

I am new to T4 Toolbox, and I want to generate code programmatically in my application.

I have some XML files stored in database, and for each file I want to generate a code file.

How do I programatically pass those records to template files to to generate output. I will have multiple template files, and each XML file may or may not call a template.

I have seen some samples, but haven't seen any that calls template files externally (e.g. a console or winform app).

Any pointers will be helpful.

Thanks in advance

Feb 18, 2010 at 6:50 PM

In order to generate code with T4 in a custom application as opposed to Visual Studio, you will need to use preprocessed templates: http://www.olegsych.com/2009/09/t4-preprocessed-text-templates/