Question

Is there a way to debug tt files? I have installed SubSonic3 and all the templates do their job except the StoredProcedures.tt. It remains empty after 'Run Custom Tool'.

Was it helpful?

Solution

Read this article that will explain the use of both:

  • JIT debugger (by placing Debugger.Break() in your template code) and
  • Manually attaching to Visual Studio process with the second instance of Visual Studio

The second one is useful to users of systems after Windows XP:

  • Vista
  • 7
  • Server 2008
  • Server 2008 R2
  • ...

OTHER TIPS

Here is an easy method.

Add lines like this one to your T4 code:

System.Diagnostics.Debug.WriteLine("This is a debug message.");

Download and run DebugView from Sysinternals. Your debug messages will appear in the output window.

(Behind the scenes, these calls use win32 OutputDebugString().)

Start your template with:

<#@ template debug="true" ...

and add:

System.Diagnostics.Debugger.Break();

to your template code to break into the compiled generator class.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top