1

一般的なコードの難読化と、アプリケーションでのエラー報告の両方にSmartAssemblyを使用しています。

アプリケーションで未処理の例外が発生した場合、例外をログに記録し、ユーザーの操作なしでアプリケーションを終了したいと考えています。これを可能にする SmartAssembly プロジェクトを作成することは可能ですか?

SmartAssembly GUI とコマンドラインでプロジェクトを設定しようとしましたが、うまくいきませんでした。以下は私が試したコマンドと引数ですが、これまでのところ、ユーザー入力なしでアプリを終了し、エラーをログに記録する方法を特定できません。

SA プロジェクトを作成します。

"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=standard;continueonerror=false,email:"my@email.com"
/reportprojectname="Shell" 
/reportcompanyname="My Company"

プロジェクトをビルドします。

"C:\Program Files\Red Gate\SmartAssembly 6\SmartAssembly.com" /build shell.saproj
4

2 に答える 2

2


SmartAssembly には、次の場所にあるカスタム ErrorReportingTemplates の例がいくつか含まれています。Red Gate/SmartAssembly 6/SDK/Exception Reporting/

例はいくつかのカテゴリにまとめられています。

Without UI Standard Custom UI Via Email Secured Proxy Silverlight Silverlight Basic

これらの各フォルダーには、目的の結果を得るために拡張できる .csproj ファイルがあります。Without UIフォルダー内には、私たちが探しているプロジェクトがあり、タイトルが付けられていますSample 01 - Without User Interface.csproj

使用するだけで.dll、再利用可能なソリューションを気にしない場合は、このファイルを直接編集して、結果の.dllファイルを使用します (別の方法として、新しいプロジェクトを作成し、への参照を取り込みますSmartAssembly.SmartExceptionsCore)。

OnReportException関数を次のように編集します。

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();
    }

混乱している場合は、最終結果の要点を次に示します。

GUI または 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"

GUI または cmd を使用してビルドします。

"C:\Program Files\Red Gate\SmartAssembly 6\SmartAssembly.com" /build shell.saproj
于 2013-10-14T16:10:58.340 に答える
0

ウェブサイトhttp://www.red-gate.com/supportcenter/Content/SmartAssembly/help/6.7/SA_UsingTheCommandLineの例によると

「標準」を「自動」に置き換える必要があります。これにより、ユーザー ダイアログが表示されずにエラー レポートが送信されることになります。

于 2013-10-11T15:00:11.140 に答える