Compiler Error CS1613
The managed coclass wrapper class 'class' for interface 'interface' cannot be found (are you missing an assembly reference?)
An attempt was made to instantiate a COM object from an interface. The interface has the ComImport and CoClass
attributes, but the compiler cannot find the type given for the CoClass
attribute.
To resolve this error, you can try one of the following:
Add a reference to the assembly that has the coclass (most of the time the interface and coclass should be in the same assembly). See References or Add Reference Dialog Box for information.
Fix the
CoClass
attribute on the interface.
The following sample demonstrates correct usage of CoClassAttribute:
// CS1613.cs
using System;
using System.Runtime.InteropServices;
[Guid("1FFD7840-E82D-4268-875C-80A160C23296")]
[ComImport()]
[CoClass(typeof(A))]
public interface IA{}
public class A : IA {}
public class AA
{
public static void Main()
{
IA i;
i = new IA(); // This is equivalent to new A().
// because of the CoClass attribute on IA
}
}
.NET feedback
.NET is an open source project. Select a link to provide feedback: