SmartAssembly includes a few examples of custom ErrorReportingTemplates,
located in Red Gate/SmartAssembly 6/SDK/Exception Reporting/
The examples are lumped into a few categories:
Without UI
Standard
Custom UI
Via Email
Secured Proxy
Silverlight
Silverlight Basic
In each of these folders, there is a .csproj file that one can extend to get their desired results.
Inside the Without UI
folder is the project we're after, titled Sample 01 - Without User Interface.csproj
If you're just after a .dll
to use and don't care about a re-usable solution, edit this file directly and use the resulting .dll
file (the alternative being to create a new project, and pull in the reference to SmartAssembly.SmartExceptionsCore
).
Edit the OnReportException
function to look like the following:
protected override void OnReportException(ReportExceptionEventArgs e)
{
for (int i=0; i<3; i++)
{
if (e.SendReport()) break;
}
e.TryToContinue = false;
System.Diagnostics.Process proc = System.Diagnostics.Process.GetCurrentProcess();
proc.Kill();
}
Here's a Gist of the final result, if you're confused.
Create the project file with the GUI or via cmd:
"C:\Program Files\Red Gate\SmartAssembly 6\SmartAssembly.com"
/create shell.saproj input=C:\Repositories\MyApp\src\shell.exe
/output=shell.exe
/reportappname="MyTestApp"
/errorreportingtemplate=MySmartAssemblyLogger.dll;continueonerror=false,email:"my@email.com"
/reportprojectname="Shell"
/reportcompanyname="My Company"
Build with the GUI or via cmd:
"C:\Program Files\Red Gate\SmartAssembly 6\SmartAssembly.com" /build shell.saproj