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

My .NET site works fine on Localhost. But on my server. I get this error.

"Failed to load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib, Version = 4.0.0.0, Culture = neutral, PublicKeyToken = b77a5c561934e089'."

(Unable to post screenshot due to policy)

This has something to do with asp: ScriptManager. I used it before on the same server, but now it shows an error.

PS: When I delete Scriptmanager, the code works fine.

Version Information: Microsoft.NET Framework Version: 4.0.30319; ASP.NET Version: 4.0.30319.272

+7
source share
2 answers

This error occurs when compiling an application with .Net 4.5, but then runs on a computer with only 4.0 installed.

In .Net 4.5, the ExtensionAttribute class was moved from System.Core to mscorlib. System.Core has a forwarder type that points to a new location in mscorlib. If you compile the application against 4.5, it expects to find ExtensionAttribute in mscorlib. If you run it against 4.0, you will get this exception because it actually lives in System.Core in 4.0

To fix this, deploy 4.5 to the server or make sure you create against 4.0

+18
source share

Just install microsoft framework v4.5 or higher on a computer or server, it worked very well for me

-one
source share

All Articles