【发布时间】:2010-09-05 11:34:03
【问题描述】:
需要通过从现成的(和工作的)自定义属性继承来修改 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
解决问题的正确方法是什么?我想做的错事是什么?
【问题讨论】:
标签: .net c#-4.0 aop postsharp log4postsharp