Import-Module : Could not load type ‘Microsoft.SharePoint.Administration.DesignPackageType’ from assembly ‘Microsoft.SharePoint.Client, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c’

Problem: When trying to import the PowerShell module for SharePoint Online with “Import-Module -Name Microsoft.Online.SharePoint.PowerShell”, I got an error message:
PS C:\> Import-Module -Name Microsoft.Online.SharePoint.PowerShell                 
Import-Module : Could not load type ‘Microsoft.SharePoint.Administration.DesignPackageType’ from assembly ‘Microsoft.SharePoint.Client, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c’.
At line:1 char:1
+ Import-Module -Name Microsoft.Online.SharePoint.PowerShell
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Import-Module], TypeLoadException
    + FullyQualifiedErrorId : System.TypeLoadException,Microsoft.PowerShell.Command
   s.ImportModuleCommand

PS C:\>

Or other similar errors:

  • Import-Module : Could not load type ‘Microsoft.SharePoint.Client.CustomerRecoveryKeyMode’
  • import-module could not load type ‘microsoft.sharepoint.administration.spresiliencemodetype’
  • import-module could not load type ‘microsoft.sharepoint.client.clientauthenticationmode’
  • import-module could not load type ‘microsoft.sharepoint.client.customer keyvault key type’
  • import-module could not load type ‘microsoft.sharepoint.client.header layouttype’
  • import-module could not load type ‘microsoft.sharepoint.client.publishing
  • import-module could not load type ‘officedevpnp.core.pages.defaultclientsidewebparts’
  • import-module could not load type ‘system.management.automation.pssnapin’
  • import-module microsoft.online.sharepoint.powershell could not load type

Solution:

This is due to the DLL Version mismatch. To resolve the issue, follow these steps:

  1. Uninstall SharePoint Online Management Shell and SharePoint Online Client SDK if installed.
  2. Delete SharePoint Online Client Assemblies from: C:\Windows\Microsoft.NET\assembly\GAC_MSIL, remove all Folders starting with name: Microsoft.SharePoint*
    Could not load type Microsoft.SharePoint.Administration.DesignPackageType from assembly
  3. Uninstall the module with “Uninstall-Module -Name Microsoft.Online.SharePoint.PowerShell -AllVersions” and reinstall the module “Install-Module -Name Microsoft.Online.SharePoint.PowerShell”

In case you face any trouble installing the module, You can download and install the SharePoint Online Management Shell. More here: How to Download and Install SharePoint Online Management Shell?

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!

9 thoughts on “Import-Module : Could not load type ‘Microsoft.SharePoint.Administration.DesignPackageType’ from assembly ‘Microsoft.SharePoint.Client, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c’

  • Great Post! Thank you so much!

    Reply
  • I couldn’t get my on-prem SharePoint 2016 server to connect to my SharePoint Online server because of the .dll mismatch issue. (From what I can tell you just can’t run the regular SharePoint Online Shell on an on-prem server with SharePoint installed.) I WAS able to get the new SharePoint Online PnP PowerShell to work though, thanks to your other post here: http://www.sharepointdiary.com/2021/02/how-to-install-pnp-powershell-module-for-sharepoint-online.html

    Thanks so much for posting that! Now I can connect our SP on-prem to our SPO and sync data between them with PowerShell! Game changer!

    Reply
  • I’m getting this same error with my on-prem server. No matter what I try, I can’t seem to run the SharePoint Online shell on my on-prem SharePoint server. I’m trying to run a script that will sync fields from our SharePoint Online instance over to our on-prem server (running SP2016). I thought I could accomplish this on the same machine with 1 script. Is this not possible? The only workaround I can think of is to have 1 machine that can run the SPO shell dump the values in a csv file that the on-prem server can pickup 15 minutes later in another script. That seems crazy though when I should be able to just run 1 PowerShell script to do the whole thing at once. Am I missing something? Any help is greatly appreciated!

    Reply
  • Thank you Thank you Thank you!

    Reply
  • I think you should specify unless you’re hosting SharePoint server on step 2 ;). This would break SharePoint.

    Remove all Folders starting with name: Microsoft.SharePoint*

    Reply
  • This doesn’t work for everyone. I’m having the same issue but I did not have SharePoint Online Management Shell (or SDK). Nor did I have the assemblies mentioned under …/GAC_MSIL). Tried uninstalling from both VSCode/7.1.5 and from PS ISE and reinstalling. Can’t even import it now. I had to install SPOME (used Gil’s link, since it’s current) just to be able to service a client request until I can spend the time to figure it out.

    Reply
  • Awesome, thank you very much. Tried following other guides and nothing worked until I came across your article here and now it works.

    Reply
  • Totally Works for me. Thanks!

    Reply
  • Thank you it worked! The last Install-Module step failed for me but I just downloaded the installation package from https://www.microsoft.com/en-gb/download/confirmation.aspx?id=35588

    Reply

Leave a Reply

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