472,119 Members | 1,718 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Guid not working?

Hey all,

I need to add a Guid to my class. In a tutorial I saw this was easy:

[Guid("16369924-5F32-4E26-AE89-8308B5C162E2")]
class someClass
{ ... }

However, I get the error "The type or namespace name 'Guid' could not be
found (are you missing a using directive or an assembly reference?)"
I'm doing it exactly the same way as in the tutorial but apparantly I'm the
only one having troubles with it. I'm using the System namespace in which
the Guid class is, but even if I use [System.Guid("xxx-etc")] it's not
working. Am I doing something wrong? And I don't have the 'Create Guid' in
the Tools menu either every website is talking about.

I hope someone can clear this up for me.

Thanks,

Razzie
Nov 16 '05 #1
3 9839
Hi Razzie,

You are actually applying an atttribute to someClass. When you do so, the
attribute name you use actually refers to an Attribute type. In your case,
you are really referring to the GuidAttribute attribute type which exists in
the System.Runtime.InteropServices namespace. Add a using statement for this
namespace in your source file.

HTH,
Rakesh
"Razzie" wrote:
Hey all,

I need to add a Guid to my class. In a tutorial I saw this was easy:

[Guid("16369924-5F32-4E26-AE89-8308B5C162E2")]
class someClass
{ ... }

However, I get the error "The type or namespace name 'Guid' could not be
found (are you missing a using directive or an assembly reference?)"
I'm doing it exactly the same way as in the tutorial but apparantly I'm the
only one having troubles with it. I'm using the System namespace in which
the Guid class is, but even if I use [System.Guid("xxx-etc")] it's not
working. Am I doing something wrong? And I don't have the 'Create Guid' in
the Tools menu either every website is talking about.

I hope someone can clear this up for me.

Thanks,

Razzie

Nov 16 '05 #2
GuidAttribute is in System.Runtime.InteropServices namespace. So, have
'using System.Runtime.InteropServices;' in your code.

"Razzie" <ra****@quicknet.nl> wrote in message
news:Ou*************@TK2MSFTNGP12.phx.gbl...
Hey all,

I need to add a Guid to my class. In a tutorial I saw this was easy:

[Guid("16369924-5F32-4E26-AE89-8308B5C162E2")]
class someClass
{ ... }

However, I get the error "The type or namespace name 'Guid' could not be
found (are you missing a using directive or an assembly reference?)"
I'm doing it exactly the same way as in the tutorial but apparantly I'm the
only one having troubles with it. I'm using the System namespace in which
the Guid class is, but even if I use [System.Guid("xxx-etc")] it's not
working. Am I doing something wrong? And I don't have the 'Create Guid' in
the Tools menu either every website is talking about.

I hope someone can clear this up for me.

Thanks,

Razzie

Nov 16 '05 #3
Thnx both replyers!

"Razzie" <ra****@quicknet.nl> wrote in message
news:Ou*************@TK2MSFTNGP12.phx.gbl...
Hey all,

I need to add a Guid to my class. In a tutorial I saw this was easy:

[Guid("16369924-5F32-4E26-AE89-8308B5C162E2")]
class someClass
{ ... }

However, I get the error "The type or namespace name 'Guid' could not be
found (are you missing a using directive or an assembly reference?)"
I'm doing it exactly the same way as in the tutorial but apparantly I'm
the only one having troubles with it. I'm using the System namespace in
which the Guid class is, but even if I use [System.Guid("xxx-etc")] it's
not working. Am I doing something wrong? And I don't have the 'Create
Guid' in the Tools menu either every website is talking about.

I hope someone can clear this up for me.

Thanks,

Razzie

Nov 16 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

24 posts views Thread by Ilija_G | last post: by
reply views Thread by Doug | last post: by
3 posts views Thread by Jeffry van de Vuurst | last post: by
6 posts views Thread by Mullin Yu | last post: by
2 posts views Thread by Lee Crabtree | last post: by
1 post views Thread by Scott M. Lyon | last post: by
1 post views Thread by Scott M. Lyon | last post: by
reply views Thread by leo001 | last post: by

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.