PowerShell Error: Add-Type: Could not load file or assembly ‘file:///C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll’ or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded

Problem: 
When trying to write a client-side PowerShell script for SharePoint Online, I got an error:

Error: Add-Type : Could not load file or assembly ‘file:///C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll’ or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.

Add-Type: Could not load file or assembly Microsoft.SharePoint.Client.dll or one of its  dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded

Verified SharePoint Server 2013 Client Components SDK is already installed to use Client-side assemblies. (if not,  You can download it from: https://www.microsoft.com/en-us/download/details.aspx?id=35585)

Solution:

You need to have PowerShell 3.0 to use Client-side assemblies of SharePoint Online. So, download and install “Windows Management Framework 3.0” at https://www.microsoft.com/en-us/download/details.aspx?id=34595

Tips: To get your currently installed PowerShell version, type: $PSVersionTable

Salaudeen Rajack

Salaudeen Rajack is a SharePoint Architect with Two decades of SharePoint Experience. He loves sharing his knowledge and experiences with the SharePoint community, through his real-world articles!

Leave a Reply