Compiler Error CS0596
The Guid attribute must be specified with the ComImport attribute
The Guid attribute must be present when using the ComImport attribute.
The following sample generates CS0596:
C#
// CS0596.cs
using System.Runtime.InteropServices;
namespace x
{
[ComImport] // CS0596
// try the following line to resolve this CS0596
// [ComImport, Guid("00000000-0000-0000-0000-000000000001")]
public class a
{
}
public class b
{
public static void Main()
{
}
}
}
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
.NET feedback
.NET is an open source project. Select a link to provide feedback: