May 25, 2021 CodeSmith
Writing CodeSmith templates requires debugging as much as writing programs, and CodeSmith supports the use of CLR's Just-in-Time debugger debugger debugger debugger debugs.
To debug a template, first open the debug debug in the CodeTemplate declaration:
<%@ CodeTemplate Language="C#" TargetLanguage="C#" Debug="True" %>
The second step is to set break points: call System.Diagnostics.Debugger.Break ();
System.Diagnostics.Debugger.Launch();
System.Diagnostics.Debugger.Break();
In calling System.Diagnostics.Debugger.Break (); You need to call System.Diagnostics.Debugger.Launch ();
This pauses visual Studio at the specified break point at Generate Output:
You can also add debug information with .Net's System.Diagnostics.Trace and System.Diagnostics.Debug.