This documentation is archived and is not being maintained.

Compiler Warning (level 1) CS0684

'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() {}