Export (0) Print
Expand All
Expand Minimize

Compiler Warning (level 1) CS0684 

Error Message

'interface' interface marked with 'CoClassAttribute' not marked with 'ComImportAttribute'

If you specify CoClassAttribute on an interface, you must also specify ComImportAttribute.

The following sample generates CS0684:

// CS0684.cs
// compile with: /W:1
using System;
using System.Runtime.InteropServices;

[CoClass(typeof(C))] // CS0684
// try the following line instead
// [CoClass(typeof(C)), ComImport]
interface I
{
}

class C
{
   static void Main() {}
}

Community Additions

ADD
Show:
© 2014 Microsoft