473,425 Members | 1,837 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,425 software developers and data experts.

compile error after defining custom attribute

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.Cla ss, 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.ConfigurationAttri buteEnum)

End Get

End Property

Public ReadOnly Property IsSecurity() As Boolean

Get

Return (AttributeEnum =
ApplicationPurposeAttributeEnum.SecurityAttributeE num)

End Get

End Property

Public ReadOnly Property ApplicationAttribute() As
ApplicationPurposeAttributeEnum

Get

Return AttributeEnum

End Get

End Property

End Class

Nov 20 '05 #1
2 3508
I've simplified the attribute class, and added full namespaces,etc., and
still get the compile errors...
<System.AttributeUsage(System.AttributeTargets.Cla ss, 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
CECC.Financial2000.Global.Interfaces.ApplicationTy peAttribute.ApplicationPur
poseAttributeEnum

Public Sub New(ByVal AppType As
CECC.Financial2000.Global.Interfaces.ApplicationTy peAttribute.ApplicationPur
poseAttributeEnum)

AttributeEnum = AppType

End Sub

Public ReadOnly Property ApplicationAttribute() As
CECC.Financial2000.Global.Interfaces.ApplicationTy peAttribute.ApplicationPur
poseAttributeEnum

Get

Return AttributeEnum

End Get

End Property

End Class
Nov 20 '05 #2
Argh...guess I should have actually read the error message, and not tried to
put 2 & 2 together...

I consolidated 3 projects having child namespaces into a single project, and
put some of the project files into subdirectories, matching the namespace.
I also moved the old assemblyinfo.vb file into the subdirectory, but I
actually needed to delete it. :)
"Harry F. Harrison" <Ha************@sbcss.k12.ca.us> wrote in message
news:eX*************@tk2msftngp13.phx.gbl...
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.Cla ss, 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.ConfigurationAttri buteEnum)

End Get

End Property

Public ReadOnly Property IsSecurity() As Boolean

Get

Return (AttributeEnum =
ApplicationPurposeAttributeEnum.SecurityAttributeE num)

End Get

End Property

Public ReadOnly Property ApplicationAttribute() As
ApplicationPurposeAttributeEnum

Get

Return AttributeEnum

End Get

End Property

End Class

Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Gianni Mariani | last post by:
Below is an example of how to do static type-checking of an erroneous set of input masks. The drawback is that it's a little too verbose and non-trivial to understand and to make it truly I'd...
5
by: Brice Prunier | last post by:
Here under 4 schemas i'm working with ( it may be long: sorry...) The context is the following : Resident.xsd imports Person.xsd and includes Common.xsd ( anonimous schema: no TargetNamespace )...
9
by: Tyler | last post by:
I am attempting to extend a legacy VB6 application by making it use a .NET component written in C# exposed through COM interop. Everything appeared to be going well (VB application creates the...
6
by: Javier Cortés Cortés | last post by:
i am getting this error when i am trying to access any file(with the ext. aspx) from my remote server. the error is : Server Error in '/' Application....
4
by: tommy | last post by:
hello everbody, i write a little asp-application with forms-authentication. i copy my aspx-files with web.config to my webspace and i get the error above... i tried to set the...
7
by: Yongsub Eric Shin | last post by:
Hi. I'm just a beginner in ASP.Net. I started writing codes and I keep on getting this Runtime Error page, where it says "Description: An application error occurred on the server. The current...
6
by: Terry Olsen | last post by:
I would like to put program info in my applications' about screen such as compile date & time, lines of code, etc. Is there a way to do this automatically when I compile?
5
by: Sadeq | last post by:
Is it possible to define custom attributes for arrays? And if so, how can I retrieve them? I mean I want to define sth like: int MyArray; and then retrieve the value of the custom...
2
by: akhilesh.noida | last post by:
I am trying to compile glibc-2.5 for ARM based board. But I am getting errors while configuring it. Please check and give your inputs for resolving this. configure command : $...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.