编译器错误 CS0596
更新:2007 年 11 月
错误消息
Guid 属性必须用 ComImport属性指定
在使用 ComImport 属性时必须有 Guid 属性。
下面的示例生成 CS0596:
// 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()
{
}
}
}