I suggest you ...

Extend T4 code generator to create multiple files from one model with one template.

Custom code generation becomes more and more important. For example network messages can be described using .xls file (each message field is one Excel cell).

At the moment T4 cannot be used to gen multiple files from one model with one template.

In case of networking multiple files must be generated: a class file per message, a switch method for dispatching messages, a parser, an asynch handler of messages and timeouts, ...

61 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    herbertherbert shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →
    Lars SchmittLars Schmitt shared a merged idea: Generate Native more then One File with T4  ·   · 

    4 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • Doug AllenDoug Allen commented  ·   ·  Flag as inappropriate

        This feature already exists. Look at the t4 templates that are created by Entity Framework 4. They generate one file per entity

      • Anonymous commented  ·   ·  Flag as inappropriate

        I am using the tangible T4 Editor that comes with a reusable sample of how to create multiple output files. Maybe you want to check this out.

      • EmilEmil commented  ·   ·  Flag as inappropriate

        This is a feature I needed in T4 in the past. Definitely gets my vote +1

      • Michael PatersonMichael Paterson commented  ·   ·  Flag as inappropriate

        I would TOTALLY vote for this if I had any left. In addition I would throw in the option to prevent the default file generation. Ie. if you have MyTestFile.tt that actually generated 4 other files and nothing in MyTestFile.cs, it would be nice to be able to turn off the generation of MyTestFile.cs.

      Feedback and Knowledge Base