fiddler运行报错:Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute'

运行fiddler,报错,如下图

原因: In .Net 4.5 the ExtensionAttribute class was moved from System.Core to mscorlib.ExtensionAttribute 类在4.5中从System.Core迁移到mscorlib中,项目运行时会按4.5的方法寻找导致异常。
有人会说,项目都是按4.0编译的,4.5也卸载了,为什么还会出现此问题?原因在于引用的第三方类库可能还是关联的4.5版本,比如我遇到这个问题是由于Entityframework引用了4.5版本导致的,而4.0和4.5从dll属性中看不出来
解释:System.Runtime.CompilerServices.ExtensionAttribute 在 .net 4.0里 在 System.Core.Dll里, 在 .net 4.5里则被移到了 mscorlib 中。
System.Core.Dll的版本显示的 4.0.0.0 版,但实际上已经被 .net 4.5替换,里面没有ExtensionAttribute 类。
未替换的版本在目录“C:Program Files (x86)Reference AssembliesMicrosoftFramework.NETFrameworkv4.0”下,用Reflector可以看到,里面有ExtensionAttribute类。
解决的方法:

解决方法: 在用户的机器上安装 .net 4.5。 对OS的要求是:

Windows 7 SP1(x86 和 x64)
Windows Server 2008 R2 SP1 (x64)
Windows Server 2008 SP2(x86 和 x64)

原文地址:https://www.cnblogs.com/lxyykl001/p/12674581.html