共用方式為


'System.Runtime.InteropServices.DllImportAttribute' 無法套用至介面方法

更新:2007 年 11 月

程序會在介面內定義,但程序定義會套用 DllImportAttribute

Common Language Runtime (CLR) 在指定 .NET Framework 以外的 Unmanaged 動態連結程式庫 (DLL) 中所定義的取代程序時,辨認出此屬性 (Attribute) 及其 EntryPoint 屬性 (Property)。當程式碼呼叫的程序已套用 DllImportAttribute 時,Common Language Runtime 會改為呼叫指定的 Unmanaged 程序。

由於介面內的程序定義不包含任何實作,因此它無法與 .NET Framework 外部的 Unmanaged 平台相互溝通。

錯誤 ID:BC31530

若要更正這個錯誤

請參閱

參考

DllImportAttribute

Interface 陳述式 (Visual Basic)