H
Harry F. Harrison
I get 2 compile errors on assembly attributes after creating a custom
attribute. If I comment out the attribute, the errors go away. I don't get
it because my attribute specifies class usage, not assembly usage.
Assembly attribute 'System.Runtime.InteropServices.GuidAttribute' is not
valid: Assembly custom attribute
'System.Runtime.InteropServices.GuidAttribute' was specified multiple times
with different values
Attribute 'System.CLSCompliantAttribute' cannot be specified more than once
in this project, even with identical parameter values.
Here is the definition of the custom attribute I created:
<System.AttributeUsage(System.AttributeTargets.Class, Inherited:=False,
AllowMultiple:=True)> _
Public Class ApplicationTypeAttribute
Inherits System.Attribute
Public Enum ApplicationPurposeAttributeEnum
BudgetAttributeEnum = 1
ConfigurationAttributeEnum = 2
MainMenuAttributeEnum = 3
ReportsAttributeEnum = 4
SecurityAttributeEnum = 5
End Enum
Private AttributeEnum As ApplicationPurposeAttributeEnum
Public Sub New(ByVal AppType As ApplicationPurposeAttributeEnum)
AttributeEnum = AppType
End Sub
Public ReadOnly Property IsConfiguration() As Boolean
Get
Return (AttributeEnum =
ApplicationPurposeAttributeEnum.ConfigurationAttributeEnum)
End Get
End Property
Public ReadOnly Property IsSecurity() As Boolean
Get
Return (AttributeEnum =
ApplicationPurposeAttributeEnum.SecurityAttributeEnum)
End Get
End Property
Public ReadOnly Property ApplicationAttribute() As
ApplicationPurposeAttributeEnum
Get
Return AttributeEnum
End Get
End Property
End Class
attribute. If I comment out the attribute, the errors go away. I don't get
it because my attribute specifies class usage, not assembly usage.
Assembly attribute 'System.Runtime.InteropServices.GuidAttribute' is not
valid: Assembly custom attribute
'System.Runtime.InteropServices.GuidAttribute' was specified multiple times
with different values
Attribute 'System.CLSCompliantAttribute' cannot be specified more than once
in this project, even with identical parameter values.
Here is the definition of the custom attribute I created:
<System.AttributeUsage(System.AttributeTargets.Class, Inherited:=False,
AllowMultiple:=True)> _
Public Class ApplicationTypeAttribute
Inherits System.Attribute
Public Enum ApplicationPurposeAttributeEnum
BudgetAttributeEnum = 1
ConfigurationAttributeEnum = 2
MainMenuAttributeEnum = 3
ReportsAttributeEnum = 4
SecurityAttributeEnum = 5
End Enum
Private AttributeEnum As ApplicationPurposeAttributeEnum
Public Sub New(ByVal AppType As ApplicationPurposeAttributeEnum)
AttributeEnum = AppType
End Sub
Public ReadOnly Property IsConfiguration() As Boolean
Get
Return (AttributeEnum =
ApplicationPurposeAttributeEnum.ConfigurationAttributeEnum)
End Get
End Property
Public ReadOnly Property IsSecurity() As Boolean
Get
Return (AttributeEnum =
ApplicationPurposeAttributeEnum.SecurityAttributeEnum)
End Get
End Property
Public ReadOnly Property ApplicationAttribute() As
ApplicationPurposeAttributeEnum
Get
Return AttributeEnum
End Get
End Property
End Class