开发者

Postsharp duplicate attribute?

Can anyone explain why I'm getting this compile error?

Duplicate 'Rad.Core.Aop.MethodArgumentValidation' attribute E:\Scripting\Rad.Core\Properties\AssemblyInfo.cs

This is the code:

[assembly: Rad.Core.Aop.MethodArgumentValidation(AttributeTargetTypes="Rad.*", AttributePriority=1)]
[assembly: Rad.Core.Aop.MethodArgumentValidation(AttributeTargetTypes = "Rad.Core.Aop.*", AttributePriority = 2, AttributeExclude=true)]

Here is the declaration of the aspect:

[Serializable]
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | Attrib开发者_如何学JAVAuteTargets.Method | AttributeTargets.Property)]
[MulticastAttributeUsage(MulticastTargets.Method, AllowMultiple=true)]
public class MethodArgumentValidationAttribute : OnMethodInvocationAspect
{ ... }

It looks like I'm following this example: http://www.sharpcrafters.com/blog/post/multicasting-of-custom-attributes.aspx

Can anyone help?


I think the error is from the C# compiler. The compiler does not understand MulticastAttributeUsageAttribute. But it does understand AttributeUsageAttribute. Be sure to allow duplicates using the AttributeUsageAttribute.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜