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

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

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


  1. Charles

    • 2017/2/2

    I had same problem before i just change CodeBehind to CodeFile and it worked.I remember it works in local but i had this problem after 

  2. Esposito

    • 2015/3/10

    Parser error: Could not load type. Please Sign up or sign in to vote. 5.00/5 (3 votes) See more: C#. ASP.NET The IIS is not able to understand the project type.

  3. Lance

    • 2021/4/8

    Also try changing CodeBehind="TestCert.aspx.cs" to CodeFile="TestCert.aspx.cs". This change is required when you change project type from 

  4. Rey

    • 2020/8/2

    Could not load type. means that a type could not be loaded. (In this case, "type" refers to Inventory1.Global). Types are located in compiled DLLs. So, either the DLL isn't available, is out of date, or doesn't contain a public type with the given name. Some possible causes are: You have no type declared with the given name.

  5. Eugene

    • 2019/5/16

    machine into the production machine, then he got that error. The cause for that error is : One of the dll which the project is refering contains 

  6. Lee

    • 2020/12/4

    EXCEPTION: One or more errors occurred. (Could not load type 'System.Security.Cryptography.SHA256Cng' from assembly 'System.Core, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089'.)Exception :Type : System.Management.Automation.RuntimeExceptionErrorRecord. Seems to be something from the System.Core that have changed.

  7. Amos

    • 2017/10/31

    Please review the following specific parse error details and modify your source file appropriately. Parser Error Message: Could not load type ' 

  8. Owen

    • 2019/3/31

    Could not load type 'System.Security.Cryptography.SHA256Cng' from assembly in Functions Powershell Trying to use azure functions to run an Exchange update powershell script. When using this command:

  9. Arian

    • 2015/5/4

    Inner exception: Could not load type 'type name' from assembly 'assembly name, Version=, Culture=neutral, PublicKeyToken=…'. Exception 

  10. James

    • 2016/7/31

    When rebuilding there was a warning about not being able to copy files into bin\roslyn. So I stopped IISExpress, deleted the bin folder and rebuild the project. There were no build warnings and the application worked fine.

  11. Edgar

    • 2018/9/5

    Please review the following specific parse error details and modify your source file appropriately. Parser Error Message: Could not load type ' 

  12. Abel

    • 2020/4/27

    Right click on the project within the solution that is failing. Unload Project Reload Project Build Project Re-build Solution

  13. Gashi

    • 2015/2/11

    Parser Error Message: Could not load type This error occurs when you create a new web application in using visual and without compiling the 

  14. Skyler

    • 2019/1/20

    Something Went Wrong : Could not load type ' System.Runtime.InteropServices.Architecture' Submitted by Pablo_Mazvarira on ‎08-05-2021 06:49 AM.

  15. Allan

    • 2015/12/24

    This FAQ explains the topic "Why do i get error message 'Could not load type' whenever I browse to my ASP.NET web site"

  16. Bianchi

    • 2018/9/7

    Fixes an issue where you get the Could not load type error when you try to create an Exchange Connector in System Center 2016 Service 

Comments are closed.

Recent Posts