469,928 Members | 1,884 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,928 developers. It's quick & easy.

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 9365
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
By using this site, you agree to our Privacy Policy and Terms of Use.