Debugging Custom T4 Templates

Thread is closed for posting
2 posts, 0 answers
  1. Jimmy
    Jimmy avatar
    1 posts
    Member since:
    Jun 2011

    Posted 12 Nov 2013 Link to this post

    I've created a custom T4 template (copied and modified the and I'm having mixed results while debugging the template.  I've added the following line to the template file just before this.RunCodeGeneration():


    Sometimes this works, other times the template executes and exits without any errors or the VS prompt to debug.

    I'm using VS 2012 with the latest install of OpenAccess Free Edition, VS project a Console App writing out the typical Hello World message.

  2. Dimitar Tachev
    Dimitar Tachev avatar
    67 posts

    Posted 15 Nov 2013 Link to this post

    Hi Jimmy,

    In general having the debugger attached just before the RunCodeGeneration method call should be enough to debug the code generation template. For more details about this process I suggest you take a look at this blog post.

    Regarding the inconstant behavior of the template execution that you have described - I was not able to reproduce this behavior both using our Fluent Library and the RLINQ file with Fluent Mapping which is a deprecated approach because our Fluent API is designed to be a code only approach providing auto-generated code only one time at the beginning.

    Please bear in mind that if you use an RLINQ file with Fluent mapping the code generation template will not be used because the RLINQ files are using the one while only the one-time code generation of our Fluent Library is using the for its code generation.

    If you still experience the same behavior after considering the above-mentioned information could you please provide us with more details about the Fluent approach that you use (Fluent Library or RLINQ file with Fluent mapping)?

    Also if you need advice or assistance with the modifications could you please provide us with more details about the goals that you need to achieve which will help us suggest you the recommended approaches and practices?

    I am looking forward to your feedback.

    Dimitar Tachev
    OpenAccess ORM Q3 2013 simplifies your model operations even further providing you with greater flexibility. Check out the list of new features shipped with our latest release!
Back to Top