'System.Runtime.InteropServices.DllImportAttribute' cannot be applied to interface methods

A procedure is defined inside an interface, but the procedure definition applies the DllImportAttribute.

The common language runtime (CLR) recognizes this attribute and its EntryPoint property as designating a replacement procedure defined in an unmanaged dynamic-link library (DLL) outside the .NET Framework. When code calls the procedure to which the DllImportAttribute is applied, the common language runtime calls the designated unmanaged procedure instead.

Because the definition of a procedure inside an interface does not include any implementation, it cannot interoperate with unmanaged platforms outside the .NET Framework.

Error ID: BC31530

To correct this error

See Also

Reference

DllImportAttribute

Interface Statement (Visual Basic)