开发者

Postsharp duplicate attribute?

开发者 https://www.devze.com 2022-12-25 17:28 出处:网络
Can anyone explain why I\'m getting this compile error? Duplicate \'Rad.Core.Aop.MethodArgumentValidation\' attribute E:\\Scripting\\Rad.Core\\Properties\\AssemblyInfo.cs

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

精彩评论

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

关注公众号