今天一个客户使用程序运行之后抛出异常:
winform 桌面程序运行异常
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.TypeLoadException: Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
刚看到这个问题,很是郁闷,平时运行都很好,为什么会产生这样的问题……
最后经过百度,找到了问题:
客户电脑.net版本为4.0,而我程序版本是4.5…… 运行之后就产生了这样的问题,
最后右键程序的每一个项目,修改目标框架:.net Framework4,重新生成,打包运行,就没有问题啦!
最后感谢其他网络达人的分享,希望对后来者也有所帮助~~