tags:

views:

46

answers:

1

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 | AttributeTargets.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?

+1  A: 

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.

Gael Fraiteur