2010-04-02 97 views
0

任何人都可以解釋爲什麼我得到這個編譯錯誤?上傳一張照片重複屬性?

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

這是代碼:

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

這裏是方面的聲明:

[Serializable] 
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Property)] 
[MulticastAttributeUsage(MulticastTargets.Method, AllowMultiple=true)] 
public class MethodArgumentValidationAttribute : OnMethodInvocationAspect 
{ ... } 

看起來像我根據這個實例:http://www.sharpcrafters.com/blog/post/multicasting-of-custom-attributes.aspx

任何人都可以幫忙嗎?

回答

1

我認爲錯誤來自C#編譯器。編譯器不理解MulticastAttributeUsageAttribute。但它確實瞭解AttributeUsageAttribute。確保使用AttributeUsageAttribute允許重複。