编译器警告(等级 1)CS0684
更新:2007 年 11 月
错误消息
“interface”接口被标记为“CoClassAttribute”而不是“ComImportAttribute”
如果在接口上指定 CoClassAttribute,则还必须指定 ComImportAttribute。
下面的示例生成 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() {}
}