I\'m trying to debug a slightly-modified version of the ADO.NET POCO Entity Generator template using the directions Oleg Sych published a few years back. I modified th
You also need debug=true:
<@#template debug="true" #> System.Diagnostics.Debugger.Launch(); Debugger.Break();
http://msdn.microsoft.com/en-us/library/bb126338.aspx
To add to andrecarlucci's solution, if you save the file, you will be prompted to reload it in the second instance of Visual Studio before you can debug it. If you don't need to make further changes but need to debug it multiple times, you don't have to save every time in order to break into the code. You can simply click the Transform All Templates button on the Solution Explorer toolbar in the original instance of Visual Studio.
Instead of using System.Diagnostics.Debugger.Launch(); or Break(), attach the debugger manually.
Final solution which works for me:
regedit:
Key (x86 systems): HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework
Key (x64 systems): HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework
value: DbgJITDebugLaunchSetting
data: 0x2
tt template:
<#@ template debug="true" hostSpecific="true" #>
<# System.Diagnostics.Debugger.Launch(); System.Diagnostics.Debugger.Break(); #>
in Visual Studio 2010 you need to call Debugger.Launch() before Debugger.Break().