I am creating a new dll application with Visual Studio 2013 based on .net 4.5.
When trying to define the Guid
attribute on my class like this:
[Guid("4245366B-0484-4A41-A2E8-C7D9FC3A4ED7")]
The compiler gives me the error
'System.Guid' is not an attribute class.
Any idea what's missing?
You must add reference to the System.Runtime.InteropServices
, like this:
using System.Runtime.InteropServices;
or state the full name for the class:
[System.Runtime.InteropServices.Guid("4245366B-0484-4A41-A2E8-C7D9FC3A4ED7")]
or use class name with postfix Attribute
:
[GuidAttribute("4245366B-0484-4A41-A2E8-C7D9FC3A4ED7")]
or use full class name with postfix Attribute
:
[System.Runtime.InteropServices.GuidAttribute("4245366B-0484-4A41-A2E8-C7D9FC3A4ED7")]
You can find more information on MSDN article
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With