既製の (そして機能する) カスタム属性から継承して、Log4PostSharp プロジェクトを変更する必要があります。これは次のようになります。
[AttributeUsage(
AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Module | AttributeTargets.Struct,
AllowMultiple = true,
Inherited = false)]
[MulticastAttributeUsage(
MulticastTargets.InstanceConstructor | MulticastTargets.StaticConstructor | MulticastTargets.Method,
AllowMultiple = true)]
#if SILVERLIGHT
[RequirePostSharp("Log4PostSharp", "Log4PostSharp.Weaver.SilverlightLogTask")]
#else
[RequirePostSharp("Log4PostSharp", "Log4PostSharp.Weaver.LogTask")]
[Serializable]
#endif
public sealed class LogWithExceptionAttribute : LogAttribute
{
public LogWithExceptionAttribute()
{
ExceptionLevel = LogLevel.Error;
}
...
}
これは、いくつかの単体テスト コードに注釈を付けるために選択した方法です。
[LogWithException]
private void DoThrowException()
{
throw new Exception("test exception");
}
コンパイル時のプロセスをデバッグしようとして、コマンド ラインからコンパイルしようとしましたが、ヒントが得られませんでした:
> msbuild Log4PostSharp.Test.csproj /p:PostSharpBuild=Diag /p:PostSharpTrace="AssemblyBinding;Project" /v:detailed
問題に取り組む正しい方法はどれですか? 私がやろうとしている間違ったことは何ですか?