Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib, Version=4.0.0.0 Error

前端 未结 2 1880
南笙
南笙 2020-12-19 07:03

My .NET site is working fine on Localhost. But, on my Server. I get this error.

\"Could not load type \'System.Runtime.CompilerServices.ExtensionAttri

相关标签:
2条回答
  • 2020-12-19 07:56

    This error comes about when you compile an application against .Net 4.5 but then run it on a machine that only has 4.0 installed.

    In .Net 4.5 the ExtensionAttribute class was moved from System.Core to mscorlib. There is a type forwarder in System.Core that points to the new location in mscorlib. If you compile an app against 4.5 it will expect to find ExtensionAttribute in mscorlib. If you then run it against 4.0 you will get this exception because in actually lives in System.Core in 4.0

    To fix this either deploy 4.5 to the server or make sure that you build against 4.0

    0 讨论(0)
  • 2020-12-19 07:57

    JUST install microsoft framework v4.5 or higher on you pc or server it's worked for me very well

    0 讨论(0)
提交回复
热议问题