How to set up a T4 template to create classes in different projects

I am using the new Entity Framework 4.1 Model approach, which uses T4 templates to generate classes from the visual model.

Can I customize T4 templates to create POCO classes and context classes (or whatever they generate) in another project?

Please note that I do not want to move the T4 template (file with .tt) to another project, and then just change the template to an EDMX file in the save project. I want it to actually generate these classes in another project, and then the location of the template. Is it possible?

thanks for answers


Notes: this is not a duplicate of the question Generate POCO classes in different projects for a project using the Entity Framework model , since the author just wanted to do what I did: move the entire template along with the created classes.

I fully understand that moving the entire template does not mean that another project will become permanent. However, I have reasons why I don't want this in the same project with POCO classes.

+5
source share
1 answer

Multiple projects with the same templates.

Whenever I use common T4 templates, I:

  • create solutions folder
  • T4 ttinclude
  • T4- , , tt
  • ttinclude, ;

, , , EDMX , . , , , ttinclude.

+2

All Articles