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 PowerShell module for SharePoint Online with "Import-Module -Name Microsoft.Online.SharePoint.PowerShell", 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:\>

Solution:
This is due to 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" and reinstall the module "Install-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' Import-Module : Could not load type  'Microsoft.SharePoint.Administration.DesignPackageType' from assembly  'Microsoft.SharePoint.Client, Version=16.0.0.0, Culture=neutral,  PublicKeyToken=71e9bce111e9429c' Reviewed by Salaudeen Rajack on February 21, 2019 Rating: 5

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.