靜態類中添加如下。此方法本人測試有效。
//缺少編譯器要求的成員“ystem.Runtime.CompilerServices.ExtensionAttribute..ctor”
namespace
System.Runtime.CompilerServices
{
public
class
ExtensionAttribute : Attribute { }
}
|
網上找的其他方法
錯誤產生環境及非完美解決辦法 錯誤提示:缺少編譯器要求的成員“System.Runtime.CompilerServices.ExtensionAttribute..ctor” 這個錯誤真的非常詭異,因為雙擊這個錯誤的時候無法定位到出錯的地方。 而且這個錯誤實在是非常不明確。 其實,產生這個錯誤的人大部分是因為引用了 Newtonsoft.Json.Net20.dll 這個類庫。 網上簡單的解決方式是:“刪除 Newtonsoft.Json.Net20.dll 后重新引用”