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 - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

Leave a Reply

Your email address will not be published. Required fields are marked *